Chopping Off the End of a List

I’m sure there are tons of these functions around, but I decided to write my own.
The listChop function chops a list down to the specified size. Use it like this:

<cfset myList = "a,b,c,d,e"/>
<!--- Chop this list down to 3 elements. --->
<cfset myList = listChop(myList, 3[, delimiter])/>

Here’s the function:

<cffunction name="listChop" returnType="string" output="no" >
<cfargument name="targetList" type="string" required="true"/>
<cfargument name="amountToKeep" type="numeric" required="true"/>
<cfargument name="delimiter" type="string" required="false" default=","/>
<cfset var listSize = listLen(arguments.targetList, arguments.delimiter)/>
<cfset var i = 0/>
<cfif arguments.amountToKeep lt 0 or listSize - arguments.amountToKeep le 0>
<cfreturn arguments.targetList/>
<cfloop from="#arguments.amountToKeep+1#" to="#listSize#" index="i">
<cfset arguments.targetList = listDeleteAt(arguments.targetList,
<cfreturn arguments.targetList/>

I’m using it in a pretty big application I’m writing, so let me know if you see
any bugs.