List of utility methods to do String Trim
trim()String.prototype.trim = function(){ return /^\s*([\d\D]*?)\s*$/.exec(this)[1]; }; | |
trim()String.prototype.trim = function() { var trimmed = this.replace(/^\s+|\s+$/g, ""); return trimmed; }; | |
trim()String.prototype.trim = function(){ return this.replace(/(^\s*)|(\s*$)/g, ""); | |
trim()String.prototype.trim = function() { return this.replace(/^\s|\s$/, ""); }; | |
trim()String.prototype.trim = function() { return this.replace(/^s+|s+$/, ''); function validate(input) { console.log(1); | |
trim()String.prototype.trim = function() { return this.replace(/^\s+|\s+$/gi, "") function get(id) { return document.getElementById(id) | |
trim()String.prototype.trim||(String.prototype.trim=function(){ return this.replace(/^\s+|\s+$/g,"")} ); | |
trim()String.prototype.trim = function() { return this.replace(/^\s+/,'').replace(/\s+$/,''); }; console.log(JSON.stringify(" foo ".trim())); | |
trim()"use strict"; String.prototype.trim = function () { return this.replace(/^\s*/, "").replace(/\s*$/, ""); | |
trim()String.prototype.trim = function(){ return this.replace(/(^\s+)|(\s+$)/g,'') var a = " bala bala " console.log(a); console.log(a.trim()); |