日期:2014-05-16  浏览次数:20329 次

js简单算法

var textLen = text.replace(/[^\x00-\xff]/gi,'xu').length;//字节数
textLen = textLen%2 == 0 ? textLen/2 : textLen/2+0.5;//字符数
//1字符 = 2字节