Javascript String replaceAll(de, para)

Description

Javascript String replaceAll(de, para)


String.prototype.replaceAll = function (de, para) {
  var str = this;
  var pos = str.indexOf(de);
  while (pos > -1) {
    str = str.replace(de, para);/*w  w w .  j a  v a  2  s  .  co m*/
    pos = str.indexOf(de);
  }
  return (str);
};



PreviousNext

Related