Wednesday, October 14, 2009

Great replaceAll in AS3

Simple and powerful. Found at:

http://snipplr.com/view/10998/replace-all/


var theContent:String = "Test String with lots of t's"
trace(replace(theContent, "t", "z"));

function replace(str:String, fnd:String, rpl:String):String{
return str.split(fnd).join(rpl);
}

No comments:

Post a Comment