Here you can find the source of isJapanese(String s)
Parameter | Description |
---|---|
s | Input |
public static boolean isJapanese(String s)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w w w .ja va 2 s. c om*/ * Returns true if the input string is Japanese. * @param s Input * @return True if Japanese */ public static boolean isJapanese(String s) { if (s == null || s.length() == 0) { return false; } Character.UnicodeBlock unicodeBlock = Character.UnicodeBlock.of(s .charAt(0)); if (unicodeBlock.equals(Character.UnicodeBlock.HIRAGANA) || unicodeBlock.equals(Character.UnicodeBlock.KATAKANA) || unicodeBlock .equals(Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS)) { return true; } return false; } }