var str : String = "abcd一二三四1234";
//str字节长度应为16,因为一个中文占两个字节
trace(String(str.replace(/[^\x00-\xff]/g,"xx").length));
//正则将1个中文替换成两个"x",实现了真正字节长度的读取.
//str字节长度应为16,因为一个中文占两个字节
trace(String(str.replace(/[^\x00-\xff]/g,"xx").length));
//正则将1个中文替换成两个"x",实现了真正字节长度的读取.