What is the syntax to split an array based on a value?

Split(expression, delimiter, count, compare)
'expression is a string; only mandatory parameter
'count - how many substrings to be returned. -1 means all substrings are returned
'compare - 0 for binary, 1 for textual

'be aware that the Split function returns an array value, not string value.
‘example – splits the array based on the delimiter “#”
Dim myArray As Variant
Dim size As Integer

myArray = Split("Regular#Regular#Vegetarian#Regular#Vegan", "#")
size = UBound(myArray)

For i = 0 To size
    MsgBox ("Guest " & i & "'s meal option is: " & myArray (i))
Next i

unnamed (2).jpg

Published by