Javascript String removeBreakLine()

Description

Javascript String removeBreakLine()


//Provides compatibility shims so that legacy JavaScript engines behave as closely as possible to ECMAScript 6 (Harmony).
require('es6-shim');

String.format = function() {
  var s = arguments[0];
  for (var i = 0; i < arguments.length - 1; i++) {       
    var reg = new RegExp("\\{" + i + "\\}", "gm");             
    s = s.replace(reg, arguments[i + 1]);
  }/* w ww  . ja  va 2  s. com*/
  return s;
}

String.prototype.removeBreakLine = function() { 
 return this.replace(/(\r\n|\n|\r)/gm," ");
}



PreviousNext

Related