コード例 #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;
  }
コード例 #2
0
 @Override
 public int getSingleCharVal(String keySequence) {
   return DubeolSymbol.DubeolSingleLetter.valueOf(keySequence).value();
 }