Javascript String dashToCamel(str)

Description

Javascript String dashToCamel(str)


String.prototype.dashToCamel = function(str) {
    if(str == undefined) {
        str = this;/*from   w w w.ja  v  a 2s  .c om*/
    }

    return str.replace(/\-+(.)/g, function (x, chr) {
        return chr.toUpperCase();
    });
}



PreviousNext

Related