JavaScript

String.prototype.leftB=function(len){

} String.prototype.lenB=function(){

} str="hi,我是中国人" alert("原始字符串:"+str+"\n字符串长度:"+str.length+"\n双字节长度:"+str.lenB()+"\n前10位字节:"+str.leftB(10))