怎么计算中英文合并的字符串的长度
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());
}
}
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());
}
}
相关文章推荐
- JAVA怎么计算中英文合并的字符串的长度
- 计算中英文合并的字符串的长度
- php中用strlen、mb_strlen函数计算中英文混排字符串长度
- Java中英文混和字符串长度计算
- php计算中英文混搭字符串长度
- php strlen mb_strlen计算中英文混排字符串长度
- 利用PHP函数计算中英文字符串长度的方法
- 利用PHP函数计算中英文字符串长度的方法
- 计算中英文字符串的长度!
- 处理字符串的一些js/jq方法(去除HTML,去除空格,计算真实长度,截取中英文字符)
- cocos Lua 计算中英文字符串长度封装接口
- 计算中英文混合字符串长度,中文算两个字符
- js 计算中英文字符串长度
- asp计算字符串长度 忽略中英文
- PHP简单有效的计算中英文字符串长度
- 【php】如何计算含有中文的字符串长度(中英文结合的字符串)
- 处理字符串的一些js/jq方法(去除HTML,去除空格,计算真实长度,截取中英文字符)
- asp.net中如何计算中英文混合字符串长度
- Javascript计算中英文混输字符串长度V2
- js 计算字符串长度 中英文