0
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"
Posted on 5:00 AM by Author and filed under
ActionScript 2.0,
ActionScript 3.0
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"
Post a Comment