ID : 3867
Split
Function
This command creates a one-dimensional array by means of splitting strings into substrings that are separated by the optional designated character.
Syntax
Split (string[, delimiter [, Number of elements]])
Guaranteed Entry
- String
- Designate a string in string type date.
- Delimiter
- Designate a delimiter in string type data. Split the string in every position where one of the same character codes as delimiter appears. Delimiter is optional. If it is omitted, a space (" ") is used as a delimiter.
- Number of elements
- Specify how many pieces to split the string into by integer type data. This is optional. If it is omitted, the string is divided where all the delimiter locate. If -1 is entered, an array including all character strings is returned.
Return Value
Return a one-dimensional variant array which stores the divided strings.
Description
- Create a one-dimensional array by splitting a string at a position of delimiter.
- Split in order from front to back. When the number of elements is specified, the split command finishes when the specified number of elements are obtained.
Related Terms
Attention
-
Example
'!TITLE "Pro1.pcs"
Sub Main
Dim aa As Variant
Dim bb As String
bb = "AB,CD,EF"
PrintDbg bb
aa = split( bb, "," )
PrintDbg aa( 0 ) 'AB
PrintDbg aa( 1 ) 'CD
PrintDbg aa( 2 ) 'EF
End Sub
ID : 3867