Search and Replace String AS2/AS3:
16 October 2008
One Comment
Today i came across the jptarry Blog and i found one intersting string replace function.
Split function splits at the given string and join method inserts and concats..
var str:String = strReplace(”this is a test page to replace this from the sentence”,”this”, “THIS”);
trace(str)
function strReplace($str:String, $search:String, $replace:String):String {
return $str.split($search).join($replace);
}
//outputs as “THIS is a test page to replace THIS from the sentence”
Translate this post











































Leave your response!