<!--- This example shows the use of GetToken --->

<HTML>

<HEAD>
<TITLE>
GetToken Example
</TITLE>
</HEAD>

<BASEFONT FACE="Arial, Helvetica" SIZE=2>
<BODY  bgcolor="#FFFFD5">

<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>

<CFELSE>
	
	<CFOUTPUT>
	<H3>Sorry, your list does not contain #form.returnElement# items.
	It contains only #ListLen(form.yourString, yourDelimiter)# elements.</H3>
	
	<H3>Please revise your query and try again.</H3>
	</CFOUTPUT>
</CFIF>

</CFIF>

<FORM ACTION="gettoken.cfm" METHOD="POST">
<P>Your string
<BR><INPUT TYPE="Text" NAME="yourString" VALUE="1 smith 14 e Jones">
<P>Element to return
<SELECT NAME="ReturnElement">
	<OPTION VALUE="1">1st
    <OPTION VALUE="2" SELECTED>2nd
    <OPTION VALUE="3">3rd
    <OPTION VALUE="4">4th
    <OPTION VALUE="5">5th
    <OPTION VALUE="6">6th
    <OPTION VALUE="7">7th
    <OPTION VALUE="8">8th
    <OPTION VALUE="9">9th
    <OPTION VALUE="10">10th
</SELECT>
<P>Delimiter (optional)
<BR><INPUT TYPE="Text" NAME="yourDelimiter">

<INPUT TYPE="Submit" NAME="">
</FORM>


</BODY>

</HTML>       
