Ejemplo n.º 1
0
  private CharType determineCharType(char ch) {
    CharType charType;
    Character.UnicodeBlock unicodeBlock = Character.UnicodeBlock.of(ch); // 한글이면 HANGUL_SYLLABLES

    if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) {
      charType = CharType.ALPHABET;
    } else if (ch >= '0' && ch <= '9') {
      charType = CharType.NUMBER;
    } else if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n') {
      charType = CharType.SPACE;
    } else if (unicodeBlock == HANGUL_SYLLABLES || unicodeBlock == HANGUL_COMPATIBILITY_JAMO) {
      charType = CharType.HANGUL;
    } else if (unicodeBlock == CJK_COMPATIBILITY_IDEOGRAPHS
        || unicodeBlock == CJK_UNIFIED_IDEOGRAPHS) { // 한중일 호환 한자 || 한중일 공통한자
      charType = CharType.HANJA;
    } else if (unicodeBlock == LETTERLIKE_SYMBOLS
        || unicodeBlock == CJK_COMPATIBILITY
        || unicodeBlock == CJK_SYMBOLS_AND_PUNCTUATION
        || unicodeBlock == HALFWIDTH_AND_FULLWIDTH_FORMS
        || unicodeBlock == BASIC_LATIN) {
      charType = CharType.SYMBOL;

    } else {
      charType = CharType.ETC;
    }
    return charType;
  }
Ejemplo n.º 2
0
 public List<Character.UnicodeBlock> getListOfLanguage(String data) {
   Set<Character.UnicodeBlock> languageSet = new HashSet<Character.UnicodeBlock>();
   char[] valueArray = data.toCharArray();
   for (int counter = 0; counter < valueArray.length; counter++) {
     languageSet.add(Character.UnicodeBlock.of(valueArray[counter]));
   }
   return (new ArrayList<Character.UnicodeBlock>(languageSet));
 }