Nodejs Utililty Methods String Trim

List of utility methods to do String Trim

Description

The list of methods to do String Trim are organized into topic(s).

Method

trim()
String.prototype.trim = function() {
  var str = this.replace(/^\s\s*/, ''),
      ws  = /\s/,
      i   = str.length;
  while (ws.test(str.charAt(--i)));
  return str.slice(0, i + 1);
};
trim()
String.prototype.trim = function() {
  return this.replace(/^\s*/, "").replace(/\s*$/, "");
};
trim()
String.prototype.trim=function()
  return this.replace(/(\s*$)|(^\s*)/g, "");
trim()
String.prototype.trim = function()
    return this.replace(/^\s+/g, '').replace(/\s+$/g, '');
};
trim()
String.prototype.trim = function() {
  var str = this.replace(/^\s+/, '');
  for (var i = str.length - 1; i >= 0; i--) {
    if (/\S/.test(str.charAt(i))) {
      str = str.substring(0, i + 1);
      break;
  return str;
...
trim()
String.prototype.trim = function() {
    return this.replace(/(^\s+)|(\s+$)/g, "");
trim()
String.prototype.trim = function() {
  a = this.replace(/^\s+/, '');
  return a.replace(/\s+$/, '');
};
trim()
String.prototype.trim = function () {
  "use strict";
  return this.replace(/^\s+|\s+$/g, '');
};
trim()
String.prototype.trim = function() {
  var re = /^\s+|\s+$/g;
  return this.replace(re, "");
trim()
String._trimRE = new RegExp().compile(/^\s+|\s+$/g);
String.prototype.trim = function()
  return this.replace(String._trimRE, "");