读书人

判断字符串是不是为英文

发布时间: 2012-11-06 14:07:00 作者: rapoo

判断字符串是否为英文

?

public static boolean isEnglish(String word) {boolean isEnglish = false;for (int i = 0; i < word.length(); i++) {if (word.charAt(i) >= 0x0000 && word.charAt(i) <= 0x00ff) {isEnglish = true;} else {isEnglish = false;break;}}return isEnglish;}

读书人网 >编程

热点推荐