by prettyscripts on 2008-03-27 11:00:41 • Leave a comment »
javascript does not come with a trim function. you need to write your own.
Code:
function trim(str) { | |
return str.replace(/^\s+|\s+$/g, ''); | |
} |
for other variations, check this.
Tags: javascript, string, trim