Purpose
Parses a delimited string into its component substring tokens. This enhances FCAS's ability to quickly and easily parse delimited strings.
Syntax
StrToken (SourceString, Delimiters, TokenNumber)
SourceString |
A delimited list of substring tokens. |
Delimiters |
A text string that specifies all of the delimiters to use when separating tokens. |
TokenNumber |
The ordinal number of the substring to return (starting with 1 for the first string). |
Example
This example returns the last login time of the administrator and breaks the resulting FirstClass scripting reply up into its constituent substrings. This code uses both the space character and the double-quote character (Chr(34)) as delimiters for the Delimiters argument. FirstClass scripting replies without quotes will not need the Chr(34) delimiter and can simply use the space or other delimiter as needed.
Sub Main()
BatchAdmin ("Get User Admin 123 +d")
Print "source string:"; fcBatchAdminReply
Print "substring 1:"; StrToken (fcBatchAdminReply, " " & Chr(34), 1)
Print "substring 2:" ; StrToken(fcBatchAdminReply, " " & Chr(34), 2)
Print "substring 2:" ; StrToken(fcBatchAdminReply, " " & Chr(34), 3)
Print "substring 2:" ; StrToken(fcBatchAdminReply, " " & Chr(34), 4)
End Sub
Running this code gives you the following output (dates and times will vary on your system):
source string: 1230 14 "2000/01/04 13:30:39"
substring 1: 1230
substring 2: 14
substring 3: 2000/01/04
substring 4: 13:30:39
|