Javascript String rstrip(chars)
/**//ww w .j a v a 2 s . c o m * Strip characters at the end of a string. * * @param chars A regex-like element to strip from the end. * @return Stripped string. */ String.prototype.rstrip = function (chars) { let regex = new RegExp(chars + "$"); return this.replace(regex, ""); };