Decode url to string - Node.js String

Node.js examples for String:URL String

Description

Decode url to string

Demo Code


exports.decode = function (str) {

    try {/*from ww w. j av a  2s . com*/
        return decodeURIComponent(str.replace(/\+/g, ' '));
    } catch (e) {
        return str;
    }
};

Related Tutorials