How do you replace text based on a charcode?
+1
A:
var charcode = 34; //example, put whatever here
var char = String.fromCharCode(charcode);
var string_to_edit = 'This is my string.';
var new string = string_to_edit.replace(char, 'whatever you are replacing with');
You may have to make that a pattern to use replace(), but I don't think so.
UltimateBrent
2010-09-28 23:13:53
@UltimateBrent. Note that strings are inmutable in Actionscript. So you can't really change a string. In this case, it means you have to re-assign the string returned by `replace` to `string_to_edit` (or any other variable, if needed).
Juan Pablo Califano
2010-09-29 01:09:40
my bad, fixed. was writing from the hip, hadn't checked it.
UltimateBrent
2010-09-30 00:37:48
This is OK, as far as it goes, but it's not AS3. You're not casting and/or scoping variables, etc.
Robusto
2010-09-30 00:49:47