GetToken
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.
Method Signature
GetToken(string=[string], index=[integer], delimiter=[string])
Arguments
Argument
Type
Required
Description
Default
string
string
true
string list to filter entries from
index
integer
true
numeric the one-based index position to retrieve the value at
delimiter
string
false
string the list delimiter
,
Examples
Tag Syntax
In the following example, the function call requests element number 2 from the string, using the delimiter '[:;".'
<bx:output>
<bx:set mystring = "four," & char( 32 ) & char( 9 ) & char( 10 ) & ",five, nine,zero:;" & char( 10 ) & "nine,ten:, eleven:;twelve:;thirteen," & char( 32 ) & char( 9 ) & char( 10 ) & ",four" >
getToken(mystring, 3) is : #getToken( mystring, 3 )#
</bx:output>
Additional Examples
token_test = GetToken( "yellow,red:,orange,blue:;,lavender,pink:;", 2, ":" );
writeDump( token_test );
Related
Last updated
Was this helpful?