Posts Tagged ‘code’
Find and Replace AS2
Friday, February 19th, 2010
A nice simple function to find and replace characters in a string using actionscript 2. This is perfect if you want to replace words or even remove words/characters from a string.
function stringReplace(myString:String, findThis:String, replaceThis:String):String{
return myString.split(findThis).join(replaceThis);
}
myString = "example-of-some-words-with-dashes"
/////Strip out all of the dashes by replacing -'s with nothing
myString = stringReplace(linkname, "-", "");
trace(myString)
Tags: actionscript, code, flash
Posted in ActionScript & Flash | No Comments »