Node How do I remove whitespace at the beginning or end of my string? is the Q&A's section answer to your problem. You'll find several ways to do it there.
If you're interested in an optimized version for trailing spaces (with discussion), try node Removing Trailing Whitespace: Multiple ways..
Michele.
In reply to Re: Strip leading and trailing blanks
by arthas
in thread Strip leading and trailing blanks
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |