I want to replace a number with a character at runtime like this:
Input:
ask 1234 question
Result:
ask * question
What is the best way to accomplish this?
I want to replace a number with a character at runtime like this:
Input:
ask 1234 question
Result:
ask * question
What is the best way to accomplish this?
Use a Regex to match a number and then do a string replace. Something along the lines of:
var str:String = "ask 1234 question"; // your string
var pattern:RegExp = /\d+/ ; // a regular expression that matches numbers
trace(str.replace(pattern, "*"));
Look up the flex 3.0 documentation for both String and Regex. Happy coding!