计算机中英文数

来源:互联网 发布:股票那个软件最好 编辑:程序博客网 时间:2024/06/05 01:06
public static int count(String str) {
if (str == null || str.length() == 0) {
return 0;
}
int count = 0;
char[] chs = str.toCharArray();
for (int i = 0; i < chs.length; i++) {
count += (chs[i] > 0xff) ? 2 : 1;
}
return count;
}
0 0
原创粉丝点击