Remove Multiple Characters or Words from a String

Flash, images Add comments

So you want to remove multiple characters or words from a string, here’s a simple way to get job done. ActionScript 2.0

var myString:String = “noe noeone chicago”;
var dontNeed:String = “noe ,?,-,:,/,’,&”;
var myArray:Array = new Array();
myArray = dontNeed.split(“,”);
trace(“character or words not needed : “+myArray);
for (i=0; i<myArray.length; i++) {
//remove unwanted characters
newString = myString.split(myArray[i]).join(“”);
myString = newString;
trace(myString);
}

Leave a Reply

visit my other website here >> noeone
Entries RSS Comments RSS Log in