Nodejs String Trim trim()

Here you can find the source of trim()

Method Source Code

String.prototype.trim = function() {
  return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}

Related

  1. trim()
    var person = {};
    person.say = function(name){
        console.log(name);
    };
    person.say("lilei");
    String.prototype.trim = function(){
        return this.replace(/(^\s*)|(\s*$)/g, "");
    function  trim(str){
    ...
    
  2. trim()
    function $(e){
      return document.getElementById(e);
    String.prototype.trim = function(){
      return this.replace(/(^\s+)|(\s+$)/g,"");
    function checkFormField(fieldObj,msgObj,re,nullMsg,errorMsg){
      msgObj.innerHTML = "";
      var v = fieldObj.value.replace(/(^\s+)|(\s+$)/g,"");
    ...
    
  3. trim()
    String.prototype.trim = function()
      return this.replace(/^\s*/, "").replace(/\s*$/, "");
    
  4. trim()
    String.prototype.trim = String.prototype.trim || function(){
      if (!this) return this;
      return this.replace(/^\s+|\s+$/g, "");
    
  5. trim()
    String.prototype.trim = function() {
      return this.replace(/^\s+/, '').replace(/\s+$/, '');
    };
    
  6. trim()
    String.prototype.trim = function() {
      return this.replace(/^s+|s+$/, ?);
    
  7. trim()
    function trim(stringToTrim) {
      return stringToTrim.replace(/^\s+|\s+$/g,"");
    function ltrim(stringToTrim) {
      return stringToTrim.replace(/^\s+/,"");
    function rtrim(stringToTrim) {
      return stringToTrim.replace(/\s+$/,"");
    String.prototype.trim = function() {return this.replace(/^\s+|\s+$/g,"");}
    String.prototype.ltrim = function() {return this.replace(/^\s+/,"");}
    String.prototype.rtrim = function() {return this.replace(/\s+$/,"");}
    
  8. trim()
    String.prototype.trim = function(){
      if(/^([ | ]*)(.*)([ | ]*)$/.test(this)){
        return RegExp.$2;
      return this;
    };
    
  9. trim()
    String.prototype.trim = function() {
        'use strict';
        return this.replace(/^\s+/,'').replace(/\s+$/,'');
    };