I assume - from your example - the variable should have a trailing "\"

var 1 = d:\temp\mywork\

Use this:
<cfset var1 = "d:\temp\mywork\">
<cfset var1 = #reverse(replace(reverse(var1), "\", ","))#>

Basically, you can only (easily) replace the first instance of something (or all, or 
where you know where the item is etc).

So reverse the string, replace the FIRST occurance, and then reverse the string again 
to restore string to its original configuration.

If this seems confusing, here it is broken down by steps:
<cfset var1 = "d:\temp\mywork\">
<!--- reverse string --->
<cfset var1 = #reverse(var1)#>
<!--- replace the first (i.e. former LAST) "\" with comma --->
<cfset var1 = #replace(var1, "\", ",")#>
<!--- reverse again to restore to original order --->
<cfset var1 = #reverse(var1)#>


>Hi,
>
>Whats the easist way to strip the last "\" from var1 and insert a "," (comma)?
>
>var 1 = d:\temp\mywork
>Results: d:\temp\mywork,
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137952
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

Reply via email to