String.prototype.trim = function () {
return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");
};
//written by Douglas Crockford
JavaScript trim()
Subscribe to:
Post Comments (Atom)
My Coding tips and tricks. Java, ASP.NET, C#, HTML, JavaScript, C++, C, JSP, Ajax and much more...
String.prototype.trim = function () {
return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");
};
//written by Douglas Crockford
No comments:
Post a Comment