| GETTOKEN | |
| Description
Determines whether a token of the list in the delimiters parameter is present in a string. |
|
| Returns
The token found at position index of the string, as a string. If index is greater than the number of tokens in the string, returns an empty string. |
|
| Category
String functions |
|
Function syntaxGetToken(string, index [, delimiters ]) |
|
| See also
Left, Right, Mid, SpanExcluding, SpanIncluding |
|
| Parameters
|
|
| Usage
The following examples show how this function works. Example A: Consider the following code: GetToken("red,blue:;red,black,tan:;red,pink,brown:;red,three", 2, ":;")
This function call requests element number 2 from the string, using the delimiter ":;". The output is as follows: red,black,tan Example B: Consider the following code: <cfset mystring = "four," & #chr(32)# & #chr(9)# & #chr(10)# & ",five, nine,zero:;" & #chr(10)# & "nine,ten:, eleven:;twelve:;thirteen," & #chr(32)# & #chr(9)# & #chr(10)# & ",four"> <cfoutput> #mystring#<br><br> </cfoutput> 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:
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(mL) (
1XLjXL) (
Þ,%LjXL) &Ü*A > A 0 K Ö j
{S Æ LL) (
L jXL) (
Þ,%LjXL) &Ü* A 5 8 0 K Ö j
{S Æ LL) (
L(jXL)J (
Þ,%LjXL) &Ü* A 5 8 0 v × j þ {S
Æ LL) (
(L
L0jX(
L)Ã (
Þ%~
(
,(S
,%LjXL) &Ü* A E P % 0 v × j þ {S
Æ LL) (
(L
L8jX(
L)Ã (
Þ%~
(
,(S
,%LjXL) &Ü* A E P % 0 J Ø j~; -:{S
: LL) /+€9 €; ,%LjXL) &~9 * 0 ¢ Ú jj
j,#(
(
LL)
(
{S : LL)
(
LHjXL)Ä
(
(N
Þ4,%LjXL) &,%LjXL) & , %LjXL) &Ü* A d m 4 0 ¢ Ü jj
j,#(
(
LL)
(
{S Æ LL)
(
L@jXL)Ê
(
(N
Þ4,%LjXL) &,%LjXL) & , %LjXL) &Ü* A d m 4 0 T Þ j
{S Ë LL) (
1XLjXL) (
Þ,%LjXL) &Ü*A > A 0 T à j
{S Í LL) (
3+
LjXL) (
Þ,%LjXL) &Ü*A > A 0 T â j
{S É LL) (
3+
LjXL) (
Þ,%LjXL) &Ü*A > A 0 � ä j
{S Å LL) (
3+LjX|U q (
|V q (
L)Æ (
Þ,%LjXL) &Ü3+
}T (N
*A d g 0 Ç å j þ {S
Å LL) (
(L
LjX{T (
|V q (
L)Æ /(S
7 s6
(L
(
Þ@|U q ~
(
,|U q (S
,%LjXL) &}U Ü(N
* A u € @ 0 Ç å j þ {S
Å LL) (
(L
LjX{T |U q (
(
L)Æ /(S
8 s6
(L
(
Þ@|V q ~
(
,|V q (S
,%LjXL) &}V Ü(N
* A u € @ 0 K ç j
{S Ê LL) (
LjXL) (
Þ,%LjXL) &Ü* A 5 8 0 v è j þ {S
Ê LL) (
(L
L jX(
L)Ã (
Þ%~
(
,(S
,%LjXL) &Ü* A E P % 0 v è j þ {S
Ê LL) (
(L
L(jX(
L)Ã (
Þ%~
(
,(S
,%LjXL) &Ü* A E P % 0 K ê j
{S Î LL) (
LjXL) (
Þ,%LjXL) &Ü* A 5 8 0 � ë j þ {S
Î LL) (
Œ (P
(R
Œ (Q
L jX(
L)É (
Þ%~
(
,(S
,%LjXL) &Ü* A \ g % 0 & | |