/ Published in: JavaScript
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
String.prototype.ltrim = function() {
return this.replace(/^\s+/, '');
};
String.prototype.rtrim = function() {
return this.replace(/\s+$/, '');
};
String.prototype.trim = function() {
return this.ltrim().rtrim();
};
Comments
 Subscribe to comments
                    Subscribe to comments
                
                