May 26
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);
}
Recent Comments