function getStringLength(s){
var realLength = 0;
var len = s.length;
var charCode = -1;
for(var i = 0; i < len; i++){
charCode = s.charCodeAt(i);
if (charCode >= 0 && charCode <= 128) {
realLength += 1;
}else{
// 如果是中文则长度加2
realLength += 2;
}
}
return realLength;
}