Stripping leading and trailing spaces - Node.js String

Node.js examples for String:Strip

Description

Stripping leading and trailing spaces

Demo Code

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

Related Tutorials