Search and Replace a String in AS2 and AS3
What an incredibly useful bit of code! Thanks to “the Pope’s Flash Blog:”
function strReplace($str:String, $search:String, $replace:String):String
{
return $str.split($search).join($replace);
}
“The ‘split’ function splits the string at the word ($search) you’re searching for. And the ‘join’ inserts the new word ($replace) between the elements, concatenates them, and returns the resulting string.”
0 Comments:
Posta un commento
<< Home