Working on it on my own, and this is the closest thing that I can come up
with:

<cfset sub = '$'>
<cfset str = 'oooooooooo'>
<cfset insertAt = 7>
<cfset res = Insert(sub, RemoveChars(str,insertAt,1),insertAt)>

<cfoutput>
        #str# (len: #Len(str)#)<br />
        #res# (len: #Len(res)#)<br />
</cfoutput>

Anyone else have a better method? 

-----Original Message-----
From: Andy Matthews [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 05, 2008 2:33 PM
To: cf-talk
Subject: Replace specific character in a string

How might I go about replacing a specific character in a string with another
character? I'd like to get a random position in a string, then replace that
specific character with something else.

So I might start with: 'XXXXXXXXXX' (10 characters) I'd get a random
position in that string (say 7).
Then I'd replace the X at position 7 with a $ giving me this: 'XXXXXX$XXX'

Does CF have a "replaceAt" method? 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314883
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to