Javascript String unescapeSpecialChars()

Description

Javascript String unescapeSpecialChars()

String.prototype.unescapeSpecialChars = function () {
    return this.replace(/\\n/g, "\n")
        .replace(/\\'/g, "\'")
        .replace(/\\"/g, '\"')
        .replace(/\\&/g, "\&")
        .replace(/\\r/g, "\r")
        .replace(/\\t/g, "\t")
        .replace(/\\b/g, "\b")
        .replace(/\\f/g, "\f")
        .replace(/\\`/g, "\`");
};



PreviousNext

Related