Tuesday, June 8, 2010

String Search & Replace (AS2 & AS3)

function strReplace($str:String, $search:String, $replace:String):String
return $str.split($search).join($replace);
var str:String = new String();
str = "we are Khmer!"

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

No comments:

Post a Comment