Path: CombineArray |
Combines an array of strings into a path.
Public Function CombineArray( ByRef Paths ( ) As String ) As String
Paths should be an array of the parts of the path to combine. If the one of the subsequent paths is an absolute path, then the combine operation resets starting with that absolute path, discarding all previous combined paths.
Zero-length strings are omitted from the combined path.
The parameters are not parsed if they have white space.
Not all invalid characters for directory and file names are interpreted as unacceptable by the Combine method, because you can use these characters for search wildcard characters. For example, while Path.Combine("c:\", "*.txt")
might be invalid if you were to create a file from it, it is valid as a search string. It is therefore successfully interpreted by the Combine method.
Exception | Condition |
---|---|
ArgumentException | One of the strings in the array contains one or more of the invalid characters defined in GetInvalidPathChars. |
The following example combines an array of strings into a path.
Public Sub Main() Dim Paths() As String Dim FullPath As String Paths = NewStrings("d:\archives", "2001", "media", "images") FullPath = Path.CombineArray(Paths) Debug.Print FullPath End Sub ' This example code produces the following output. ' ' d:\archives\2001\media\images