//计算中文字符长度function checksum(chars){var fuhao=[',','。',';','!',':','【','】','…','?','“','”','—','·' ,'、','《' ,'》' ,'(',')' ,'¥','@' ];//一些中文符号var fuhao_code=[];for(var j=0;j<fuhao.length;j++){//console.log('---##--' , fuhao[j].charCodeAt(0) );fuhao_code.push(fuhao[j].charCodeAt(0));}//console.log('---22222--' , fuhao_code );var sum = 0;for (var i=0; i<chars.length; i++){var c = chars.charCodeAt(i);//console.log('---c---' , c);if ((c>=0x0001 && c<=0x007e) || (0xff60<=c && c<=0xff9f)){ //sum++;//一些数字、字母、英文符号等}else if( fuhao_code.indexOf(c) >= 0 ){//一些中文符号}else{sum+=2;}}return sum/2;}
200字范文,内容丰富有趣,生活中的好帮手!