> 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? 

No but there are a couple of options... 

string = rereplace(string,"^(.{6}).(.*)$","\1$\2") 

or 

string = insert("$",removechars(string,7,1),7) 

If you do this sort of thing a lot, you could write a UDF for it. 

hth


-- 
s. isaac dealey  ^  new epoch
 isn't it time for a change? 
     ph: 781.769.0723

http://onTap.riaforge.org/blog



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:314882
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to