leafiy
4/26/2018 - 6:47 PM

simple trim #regex #string

simple trim #regex #string

String.prototype.trim = function () {
    return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
  };

// or
//  \/^s*|s*$\/g