var jmz = {};
jmz.GetLength = function(str) {
return str.replace(/[\u0391-\uFFE5]/g,"aa").length; //先把中文替换成两个字节的英文,在计算长度
};
alert(jmz.GetLength('测试测试ceshiceshi'));
JS判断字符长度
猜你喜欢
转载自blog.csdn.net/seven_north/article/details/87073473
今日推荐
周排行