While working on a Flash AS3 application, I needed to manipulate a string and found out that old AS1 and AS2 str.replace() would not work in the same way in the AS3. Instead I ended up using split and join functions for a simple string replacement.
var str:String = "No Donuts for you!";
//replace a word with another
str = str.split("Donuts").join("Walnuts");
Hope that helps.
Author: Ali Qureshi
I am a web & mobile app developer based in Lahore. I have been developing creative, interactive, usable & successful web apps, web portals, php and Flash action scripting, REST apis, WordPress plugins & themes. In recent years, I have worked on Ionic, Angular and TypeScript for hybrid mobile apps, Flutter & Dart, React & React Native, and Swift native iOS mobile app development.
Nice I used replace() before as well but your method works much better