javascript: trim string

by prettyscripts on 2008-03-27 11:00:41 • Leave a comment »

javascriptcode

javascript does not come with a trim function. you need to write your own. function trim(str) { return str.replace(/^\s+|\s+$/g, ''); } for other variations, check this. more »

Tags: javascript, string, trim