Public Function StringToVariantMatrix( _
ByRef rTo() As Variant _
, ByVal vFm As String _
, Optional ByVal vColumnSeparator As Variant _
, Optional ByVal vRowSeparator As Variant _
, Optional ByVal vCompare As Variant _
) As Boolean
Parse a delimited string into a two-dimensional array of Variants. Example:
Dim avarTable() As Variant
StringToVariantMatrix(avarTable(), "From=feet&To=meters", "=", "&") = True
' Column--v v--Row
avarTable(1, 1) = "From"
avarTable(2, 1) = "feet"
avarTable(1, 2) = "To"
avarTable(2, 2) = "meters"See also:
VariantMatrixToString Function (inverse)
ParseURLEncoded FunctionrTo: Dynamic, two-dimensional Variant array that will receive the parts of the string vFm. rTo must be dynamic so that this function can re-dimension it appropriately. rTo need not be initialized (with ReDim) before being passed to this function.
Note: The lower bound of each dimension is initialized to 0 (zero), but the first element used is always 1 (one).
Note: Unused cells are left Empty.
vFm: String that will be parsed into a two-dimensional tabular format and returned via rTo.
Return value: Function does "ReDim rTo(0 To 0, 0 To 0)" and returns False if vFm is Null or cannot be fixed-up to a String. (Function currently returns True in all other cases.)
vColumnSeparator: String that separates columns within the delimited text. vColumnSeparator defaults to Null if it is missing or cannot be fixed-up to a String. When vColumnSeparator is Null, there is no column separator, meaning that each row will be treated as one column.
vRowSeparator: String that separates rows within the delimited text. vRowSeparator defaults to Null if it is missing or cannot be fixed-up to a String. When vRowSeparator is Null, there is no row separator, meaning that the entire String will be treated as one row (this single row can still have multiple columns).
vCompare: Specifies the type of comparison used to find separator strings within the String vFm. vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number.
Note: The Row and Column separator strings should be different. When the Row and Column separators are the same, then this function acts as if the Column separator was Null.
Return to ENTISOFT Home Page
Copyright © 1999-2005 Entisoft