Javascript String gblen()

Description

Javascript String gblen()



String.prototype.gblen = function() {
    var len = 0;/* ww w.  j av a 2 s .com*/
    for (var i=0; i<this.length; i++) {
        if (this.charCodeAt(i)>127 || this.charCodeAt(i)==94) {
             len += 2;
         } else {
             len ++;
         }
     }
    return len;
}



PreviousNext

Related