Javascript String trimStr(s)
String.prototype.trimStr = function (s) { return this.replace(new RegExp("^" + s + "+|" + s + "+$", "gm"), ""); }