Javascript String toFullWidth()

Description

Javascript String toFullWidth()


String.prototype.toFullWidth = function() {
    var r = '',c;
    for (var i = 0; i < this.length; i++) {
        c = this.charCodeAt(i);/* w w  w.  ja  va  2s  .c o  m*/

        if (c > 0x00 && c <= 0xEF ) {
            r += String.fromCharCode(0xFF00 ^ (c - 0x20))
        } else {
            r += this[i];
        }

    }

    return r;
};



PreviousNext

Related