-----------------------------------------------------------------------
FAQ Topic - How do I trim whitespace -
trim/trimRight/trimLeft
-----------------------------------------------------------------------
Using Regular Expressions (JavaScript 1.2/JScript 3+) :
String.prototyp e.trimLeft =
function()
{
return this.replace(/^\s+/,'');
}
String.prototyp e.trimRight =
function()
{
return this.replace(/\s+$/,'');
}
String.prototyp e.trim =
function()
{
return this.replace(/^\s+|\s+$/g,'');
}
--
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javas cript FAQ is at http://jibbering.com/faq/index.html.
The FAQ workers are a group of volunteers. The sendings of these
daily posts are proficiently hosted by http://www.pair.com.
FAQ Topic - How do I trim whitespace -
trim/trimRight/trimLeft
-----------------------------------------------------------------------
Using Regular Expressions (JavaScript 1.2/JScript 3+) :
String.prototyp e.trimLeft =
function()
{
return this.replace(/^\s+/,'');
}
String.prototyp e.trimRight =
function()
{
return this.replace(/\s+$/,'');
}
String.prototyp e.trim =
function()
{
return this.replace(/^\s+|\s+$/g,'');
}
--
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javas cript FAQ is at http://jibbering.com/faq/index.html.
The FAQ workers are a group of volunteers. The sendings of these
daily posts are proficiently hosted by http://www.pair.com.
Comment