This functionality is built into the Character.UnicodeBlock class. Some examples of the Unicode blocks related to the Japanese language:
Character.UnicodeBlock.of('誰') == CJK_UNIFIED_IDEOGRAPHS
Character.UnicodeBlock.of('か') == HIRAGANA
Character.UnicodeBlock.of('フ') == KATAKANA
Character.UnicodeBlock.of('フ') == HALFWIDTH_AND_FULLWIDTH_FORMS
Character.UnicodeBlock.of('!') == HALFWIDTH_AND_FULLWIDTH_FORMS
Character.UnicodeBlock.of('。') == CJK_SYMBOLS_AND_PUNCTUATION
But, as always, the devil is in the details:
Character.UnicodeBlock.of('A') == HALFWIDTH_AND_FULLWIDTH_FORMS
where A
is the full-width character. So this is in the same category as the halfwidth Katakana フ
above. Note that the full-width A
is different from the normal (half-width) A
:
Character.UnicodeBlock.of('A') == BASIC_LATIN