I just put together a TextUtils class with my Actionscript implementation of str_replace.
You can use it like below:
var content:String = "hello world";It gets interesting, when you gotta do something like this:
//outputs 'Hello World'
var content:String = "h.e.l.l.o; w,o,r,l,d";
trace(TextUtils.str_replace([",", ".", ";"], "", content))
//outputs 'hello world'
If you find it useful, go ahead and use it.
Of course, Actionscript 3.0 does have its own implementation of 'replace' function in the String class, which is pretty sleek as well. It also includes support for Regular Expression based search and replace. Check out the documentation AS3.0 String.replace here.
Post a Comment