Jun 21, 2010

Flash String Replace - As2

Just a small function to replace text in a string, handy for things at times…

//String Replace Class

function stringReplace(block:String, find:String, replace:String):String
{
return block.split(find).join(replace);
}

myString = "I love actionscript";
output = stringReplace(myString, "love", "hate");
trace("NewString = " + output);

SOURCE

No comments: