Return to Snippet

Revision: 45440
at April 30, 2011 15:41 by anagai


Initial Code
//full trim
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}

//left trim
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}

//right trim
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}

Initial URL

                                

Initial Description

                                

Initial Title
Javascript Trim Functions

Initial Tags
javascript

Initial Language
JavaScript