Information
Showing posts with label
trim string javascript
.
Show all posts
Showing posts with label
trim string javascript
.
Show all posts
Wednesday, February 3, 2010
Trim Function in Javascript
function
trim
(str)
{
if(!str || typeof str != '
string
')
return null;
return
str.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');
}
Older Posts
Home
Subscribe to:
Posts (Atom)