Exemplo n.º 1
0
  @Override
  public String parseKoreanStringToEngSpell(String korean) throws IllegalFormatException {
    String result = "";

    for (int i = 0; i < korean.length(); i++) {
      int ch = korean.charAt(i);
      if (((char) ch) >= '가' && ((char) ch) <= '힣') {
        ch -= 0xAC00;
        int initialConsonant = ch / (21 * 28);
        ch %= (21 * 28);
        int Vowel = ch / 28;
        ch %= 28;
        int finalConsonant = ch;

        result +=
            DubeolSymbol.DubeolIConsonant.values()[initialConsonant + 1].toString()
                + DubeolSymbol.DubeolVowel.values()[Vowel + 1].toString();

        if (finalConsonant != 0) result += DubeolSymbol.DubeolFConsonant.values()[finalConsonant];
      } else if (ch >= 'ㄱ' && ch <= 'ㅣ') {
        ch -= 0x3130;
        result += DubeolSymbol.DubeolSingleLetter.values()[ch - 1];
      } else {
        result += (char) ch;
      }
    }

    return result;
  }
Exemplo n.º 2
0
 @Override
 public boolean isFConsonant(String tFCon) {
   try {
     @SuppressWarnings("unused")
     DubeolSymbol.DubeolFConsonant check1 =
         DubeolSymbol.DubeolFConsonant.valueOf(tFCon); // dummy alloc.
     return true;
   } catch (Exception e)
   // if checked character is abnormal
   {
     return false;
   }
 }