/ Published in: JavaScript
Expand |
Embed | Plain Text
String.prototype.trim = function( charlist ) { var chars = charlist || "\\s"; return this.replace( new RegExp( "^[" + chars + "]+|[" + chars + "]+$", "g" ), "" ); } String.prototype.ltrim = function( charlist ) { var chars = charlist || "\\s"; return this.replace( new RegExp( "^[" + chars + "]+", "g" ), "" ); } String.prototype.rtrim = function( charlist ) { var chars = charlist || "\\s"; return this.replace( new RegExp( "[" + chars + "]+$", "g" ), "" ); }
You need to login to post a comment.
