Trim Function in JavaScript

December 26, 2007

function trim(stringToTrim)
{
return stringToTrim.replace(/^\s+|\s+$/g,”");
}