Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

Feedback: irt.org FAQ Knowledge Base Q1310

Feedback on: irt.org FAQ Knowledge Base Q1310

Sent by Dan Hines on July 19, 2000 at 15:33:48: - feedback #1505

Comments:
I use the following to trim spaces:

str.replace(/^\s*/, '').replace(/\s*$/, '');


Sent by Deb Reichert on August 08, 2000 at 15:07:50: - feedback #1592

Length:
Too short

Technical:
Just right

Comments:
We were wondering how to modify this code to check for these values (spaces, carriage returns, etc) as if a null entry -- no text, just spacing, and then return an error -- this is a required field; only spaces have been spplied.


Sent by Shilpa on December 19, 2001 at 04:00:30: - feedback #3431

Worth:
Very worth reading

Comments:
Hey Thanks for this....it was excellent solution for the problem.


Sent by Mauricio Zuluaga on September 09, 2002 at 11:55:00: - feedback #4134

Comments:
Reading at the documentation for RegExp I found that the replace method returns a new string. It doesn't modify the string that invokes the method.

I change the trim function to this in order to make it work:

function trim(str)
{
var newString = str.replace(/^\s*/, '').replace(/\s*$/, '');
return newString;
}


©2018 Martin Webb