A couple of basic string parsing functions
If you are using ColdFusion 9+, you should abandon your vars within functions and move toward using the LOCAL scope.  LOCAL vars do not escape the function.

This:

&lt;cfset var last = getLast(arguments.str)&gt;
&lt;cfset var lastLen = len(last) + 1&gt;
&lt;cfset var thisLen = len(str) - lastLen&gt;
&lt;cfset var returnVar = str&gt;


Should be:

&lt;cfset LOCAL.last = getLast(arguments.str)&gt;
&lt;cfset LOCAL.lastLen = len(LOCAL.last) + 1&gt;
&lt;cfset LOCAL.thisLen = len(LOCAL.str) - LOCAL.lastLen&gt;
&lt;cfset LOCAL.returnVar = str&gt;