Trim()
//Trim function trim(val,optval) { if(optval == "compress") { val = val.replace(/\s+/g, ""); }else if(optval == "trim") { val= val.replace(/^\s+/, "").replace(/\s+$/, ""); }else if(optval == "rtrim") { val = val.replace(/\s+$/, ""); }else if(optval == "ltrim") { val = val.replace(/^\s+/, ""); }else { val= val.replace(/^\s+/, "").replace(/\s+$/, ""); } return val; }