Javascript String replaceArray( find, replace )
String.prototype.replaceArray = function( find, replace ) { var str = this, regex; for ( var i = 0; i < find.length; i++ ){ regex = new RegExp( find[i], "g" ); str = str.replace( regex, replace[i] ); }/*from w ww . jav a2 s.c om*/ return str; };
String.prototype.replaceArray = function(find, replace) { var replaceString = this; var regex;/*from ww w . j a v a2 s. c o m*/ for (var i = 0; i < find.length; i++) { regex = new RegExp(find[i], "g"); replaceString = replaceString.replace(regex, replace[i]); } return replaceString; };