Tuesday, March 17, 2009

Quicktip: @Trim in JavaScript

Just needed this one - thought you might find it helpful as well, so I am blogging it:

If you need to simulate @Trim (formula) / fulltrim (Lotusscript) in JavaScript (string-only), you can do so with the following function using regular expressions:

function trim(txt) {
   return txt.replace(/(^ +| +$)/g,'').replace(/ +/g, ' ');
}

1 Comments:

Blogger codemaster07 said...

If you need some more @Functions in JS -> http://www.breakingpar.com/bkp/home.nsf/Doc!OpenNavigator&1DB402EE745E8AE687256E4C006F8D59&Remote

Have a great weekend!

March 27, 2009 8:57 PM  

Post a Comment

Thank you for your comment. It will be published shortly. Keep having a great day!

<< Home