您的位置:首页 > 其它

怎么计算中英文合并的字符串的长度

2006-05-17 17:33 357 查看
import java.io.*;
public class StringTest
{
public static void main(String[] args)
{
String aString = "这是一个测试串,This is a test string.";
String anotherString = null;
try {
anotherString = new String(aString.getBytes("GBK"), "ISO8859_1");
}
catch (UnsupportedEncodingException ex) {
}
System.out.println(aString.length() + "," + anotherString.length());
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: