Name

GetToken

Synopsis

GetToken(string, index [, delimiters ])

Returns the token from string occupying the specified index position. An optional set of delimiters may be specified. If no delimiters are specified, ColdFusion uses the default of spaces, tabs, and newline characters. If index is greater than the total number of tokens in string, GetToken( ) returns an empty string. GetToken( ) is similar in function to the ListGetAt( ) function but is more versatile because it uses multiple sets of delimiters. Note that the GetToken( ) function currently treats successive instances of the same delimiter as a single delimiter. Here’s an example of this function:

<CFSET MyString="999-99-9999">

<CFOUTPUT>
<B>String:</B> #MyString#
<P>GetToken(MyString, 3, "-"): #GetToken(MyString, 3, "-")#
</CFOUTPUT>

Get Programming ColdFusion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.