Remove space :
string.replace(/^\s*|\s*$/,"");
JAVASCRIPT : Tips
Moderator: General Moderators
Re: JAVASCRIPT : Tips
Also note that String#trim has been added to the JavaScript spec. It is faster and more reliable. For example, some browsers do not include weird Unicode characters that display as a space as part of `\s`.
Re: JAVASCRIPT : Tips
This is better suited for the Javascript forum.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.