Code: Select all
Function MergeArrays(strResult() As String, strTributary() As String)
Dim lngAr As Long
For lngAr = LBound(strTributary) To UBound(strTributary)
ReDim Preserve strResult(UBound(strResult) + 1)
strResult(UBound(strResult)) = strTributary(lngAr)
Next lngAr
End Function
Sub TESTMergeArrays()
Dim strResult() As String
Dim strTributary() As String
' strResult = Split("alpha beta gamma", " ")
' strTributary = Split("delta epsilon", " ")
' Call MergeArrays(strResult, strTributary)
' strResult = Split("alpha beta gamma", " ")
' strTributary = Split("", " ")
' Call MergeArrays(strResult, strTributary)
' strResult = Split("", " ")
' strTributary = Split("delta epsilon", " ")
' Call MergeArrays(strResult, strTributary)
strResult = Split("", " ")
strTributary = Split("", " ")
Call MergeArrays(strResult, strTributary)
End Sub
I can't remember seeing a VBA string array with a negative upper-bound.
Is this a unique feature of the Split() function?
The -1 UBound does not appear to be related to the parameter "limit: Optional. Number of substrings to be returned; –1 indicates that all substrings are returned "
Thanks
Chris