After scouring Google for hours trying to find some easy string replacement function in AS3, I ran across this.


private function str_replace( replace_with:String, replace:String, original:String ):String
{
var array:Array = original.split(replace_with);
return array.join(replace);
}

As you can see, it’s quite simple. You provide three things, replace_with – the new text, replace – what you want to replac, and the original string.

Just thought I’d share that!

Advertisements