Monday, November 17, 2008

Flash replace string function

code:

String.prototype.replace = function(searchStr, replaceStr):String {
var arr:Array = this.split(searchStr);
return arr.join(replaceStr);
};

----
to use:

string.replace("string to find","string to replace");

No comments: