ColdFusion ListGetAt() vs. GetToken()

<!--- Create out ColdFusion list. --->
<cfset strList = "Face,It,Maria,Bello,Is,Crazy,Hot!" />
 
 
<!---
	To test how each method works, not only are we going
	to loop over the elements in the list, we are going
	to do so in an out-of-bounds fashion; notice that we
	are starting before 1 and going until after the end
	of the list.
--->
<cfloop
	index="intI"
	from="0"
	to="#(ListLen( strList, ',' ) + 1)#"
	step="1">
 
	<!---
		Because these methods might error, we are going
		to wrap each one its own CFTry / CFCatch block
		and display any caught errors.
	--->
	<p>
		ListGetAt( #intI# ):
 
		<cftry>
			#ListGetAt( strList, intI, "," )#
 
			<!--- Catch error and display message. --->
			<cfcatch>
				ERROR: #CFCATCH.Message#
			</cfcatch>
		</cftry>
 
		<br />
 
		GetToken( #intI# ):
 
		<cftry>
			#GetToken( strList, intI, "," )#
 
			<!--- Catch error and display message. --->
			<cfcatch>
				ERROR: #CFCATCH.Message#
			</cfcatch>
		</cftry>
	</p>
 
</cfloop>

For Cut-and-Paste