Java String with Chinese word only
//package com.demo2s; public class Main { public static void main(String[] argv) throws Exception { String str = "\u2323"; System.out.println(allChinese(str)); }/* ww w. j a v a 2 s. c o m*/ public static boolean allChinese(String str) { if (isNullOrEmpty(str)) { return false; } boolean allChinese = true; for (char c : str.toCharArray()) { if (!isChinese(c)) { allChinese = false; break; } } return allChinese; } public static boolean isNullOrEmpty(String str) { return str == null || str.trim().length() == 0; } public static boolean isChinese(char c) { Character.UnicodeBlock ub = Character.UnicodeBlock.of(c); return ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS || ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A || ub == Character.UnicodeBlock.GENERAL_PUNCTUATION || ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION || ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS; } }