ParseStr Statement / Function
Parses a string and return array of tokens.
Syntax
ParseStr inputString$, tokens$(), delimiters$
numTokens = ParseStr(inputString$, tokens$(), delimiters$)
Parameters
- inputString$
- Specify the string to be analyzed.
- tokens$()
- Specifies an array to store tokens. The array declared by ByRef cannot be specified.
- delimiters$
- Specify one or more delimiter characters.
Return Values
When used as a function, the number of tokens parsed is returned.
Description
When delimiter characters in a string appear consecutively, no tokens are stored, and the number of tokens is not counted.
Get the number of analyzed tokens from the return value or from the maximum index of the token array got using the UBound function.
See Also
Redim, String, UBound Function
ParseStr Statement Example
String toks$(0)
Integer i
ParseStr "1 2 3 4", toks$(), " "
For i = 0 To UBound(toks$)
Print "token ", i, " = ", toks$(i)
Next i