If you define these functions in your program, your strings will have an upgraded version of trim
that can trim all given characters:
String.prototype.trimLeft = function(charlist) {_x000D_
if (charlist === undefined)_x000D_
charlist = "\s";_x000D_
_x000D_
return this.replace(new RegExp("^[" + charlist + "]+"), "");_x000D_
};_x000D_
_x000D_
String.prototype.trim = function(charlist) {_x000D_
return this.trimLeft(charlist).trimRight(charlist);_x000D_
};_x000D_
_x000D_
String.prototype.trimRight = function(charlist) {_x000D_
if (charlist === undefined)_x000D_
charlist = "\s";_x000D_
_x000D_
return this.replace(new RegExp("[" + charlist + "]+$"), "");_x000D_
};_x000D_
_x000D_
var withChars = "/-center-/"_x000D_
var withoutChars = withChars.trim("/-")_x000D_
document.write(withoutChars)
_x000D_