Gettoken - MACROMEDIA COLDFUSION 4.5-CFML LANGUAGE Reference

Cfml language reference
Table of Contents

Advertisement

372

GetToken

Returns the specified token in a string. Default delimiters are spaces, tabs, and newline
characters. If index is greater than the number of tokens in string, GetToken returns an
empty string.
See also Left, Right, Mid, SpanExcluding, and SpanIncluding.
Syntax
GetToken( string , index [, delimiters ])
string
Any string.
index
Any integer > 0 that indicates position of a token.
delimiters
String containing sets of delimiters.
Examples
<!--- This example shows the use of GetToken --->
<HTML>
<HEAD>
<TITLE>
GetToken Example
</TITLE>
</HEAD>
<BODY BGCOLOR=silver>
<H3>GetToken Example</H3>
<CFIF IsDefined("FORM.yourString")>
<!--- set delimiter --->
<CFIF FORM.yourDelimiter is not "">
<CFSET yourDelimiter = FORM.yourDelimiter>
<CFELSE>
<CFSET yourDelimiter = " ">
</CFIF>
<!--- check that number of elements in list is
greater than or equal to the element sought to return --->
<CFIF ListLen(FORM.yourString, yourDelimiter) GTE FORM.returnElement>
<CFOUTPUT>
<P>Element #FORM.ReturnElement# in #FORM.yourString#,
delimited by "#yourDelimiter#"
<BR>is:#GetToken(FORM.yourString, FORM.returnElement, yourDelimiter)#
</CFOUTPUT>
...
CFML Language Reference

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-CFML LANGUAGE and is the answer not in the manual?

This manual is also suitable for:

Coldfusion 4.5

Table of Contents