Trim Whitespace from a String

This function will trim any whitespace from the left and right of a string and return whatever remains.

function trim(s) { return (s.toString.replace(/^\s*|\s*$/g,'')); }