Javascript String toHaftWidth()

Description

Javascript String toHaftWidth()

String.prototype.toHaftWidth = function() {
    var r = '',c;
    for (var i = 0; i < this.length; i++) {
        c = this.charCodeAt(i);/*from  w  ww.ja va2s .c  o m*/

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

    }

    return r;
};



PreviousNext

Related