1. String.prototype.gblen = function() {
    2. var len = 0;
    3. for (var i=0; i<this.length; i++) {
    4. if (this.charCodeAt(i)>127 || this.charCodeAt(i)==94) {
    5. len += 2;
    6. } else {
    7. len ++;
    8. }
    9. }
    10. return len;
    11. }