jx's Gravatar

Posted by jx on 2008-06-14 15:13:13 UTC

a little change:

function trim13 (str) {
var ws = /\s/, _start = 0, _end = str.length-1;

while(ws.test(str.charAt(_start))) _start++;
if( _start > _end) return '';

while(ws.test(str.charAt(_end))) _end--;
return str.slice(_start , _end );
}



advertising



« Back to the article