标签:rip har 对象 lengthb ret asc str alert code
String.prototype.lengthB=function(){ varb=0,l=this.length; if(l){ for(var i = 0; i<l; i++) { if(this.charCodeAt(i)>255){ b+=2; }else{ b++; } }; returnb; }else{ return 0; } } var s="string对象长度"; alert(s.lengthB());
标签:rip har 对象 lengthb ret asc str alert code
原文地址:http://www.cnblogs.com/liguangsunls/p/6763827.html