javascript trim

function trim(str) { var str = str.replace(/^ss*/, ''), ws = /s/, i = str.length; while (ws.test(str.charAt(--i))); return str.slice(0, i + 1); }

source: http://blog.stevenlevithan.com/archives/faster-trim-javascript


posted by dharh 1:11 PM Feb 4th, 2008



2011: 5 3 1
2010: 12 9 7 1
2009: 12 11 8 5
2008: 12 5 4 3 2 1
2007: 12 11 10 9 8 7 6 5 4 3 2 1
2006: 12 11 10 9 8 7 6 5 4 3 2 1
2005: 12 10 7 6
2004: 10 9 6 5 4 3 2 1