User Guide

GetToken 511
The output is as follows:
four,
,five, nine,zero:;
nine,ten:, eleven:;twelve:;thirteen,
,four
The GetToken function recognizes explicit spaces, tabs, or newline characters as the parameter
delimiters (To specify a space character, the code is
chr(32); a tab character, chr(9); and a
newline character,
chr(10).)
In the example string
mystring, there is:
A forced space between the substrings "four," and ",five"
A literal space between "five," and "nine"
A literal space between "ten:," and "eleven,"
A forced space between "thirteen," and ",four"
In the following call against mystring, no spaces are specified in delimiters (it is omitted), so
the function uses the space character as the
string delimiter:
<br>
<cfoutput>
GetToken(mystring, 3) is : #GetToken(mystring, 3)#
</cfoutput><br>
The output of this code is as follows:
GetToken(mystring, 3) is : nine,zero:;
The function finds the third delimiter, and returns the substring just before it that is between the
second and third delimiter. This substring is "
nine,zero:;".
Example C: Consider the following code:
<cfset mystring2 = "four,"
&#chr(9)# & #chr(10)#
& ",five,nine,zero:;"
& #chr(10)#
& "nine,ten:,eleven:;twelve:;thirteen,"
& #chr(9)# & #chr(10)# & ",four">
<cfoutput>
#mystring2#<br>
</cfoutput>
The output is as follows:
four,
,five,nine,zero:;
nine,ten:,eleven:;twelve:;thirteen,
,four
The following is a call against mystring2:
<cfoutput>
GetToken(mystring2, 2) is : #GetToken(mystring2, 2)#
</cfoutput>
The output is as follows:
GetToken(mystring2, 2) is : ,five,nine,zero:;