How to convert to Korean initials

Hi, I am working on a Korean Android application.

Here I implemented a listview with headers in alphabetical order to display contacts. I used the substring method of the String class to get the first letter as the section title. For Korean contacts, im also takes the first letter using the substring method. Here I need to display the Korean initials, like ㄱ ㄴ ㄷ ㄹ ㅁ ㅂ ㅅ ㅇ ㅈ ㅊ ㅋ ㅌ ㅍ ㅍ ㅎ ㅎ ㅎ ㅎ ㅎ ㅎ ㅎ ㅎ ㅎ ㅎ ㅎ ㅎ ㅎ ... I don’t know which first letter of the Korean contact list matches these Korean initials.

So, please help me how can I do this or give a link to the following ...

Thanks at Advance ..

+3
source share
2 answers

, , intellisense - , Jamo. , , .

-, . , ( shift + character). , :

ㄱㄲㄴㄷㄸㄹㅁㅂㅃㅅㅆㅇㅈㅉㅊㅋㅌㅍㅎ

, , , - , .

Windows, , Ka (가) Unicode 0xAC00 ( , 44032), , . , , FirstLetter - , 44032.

0xAE4C ( 44620), (.. , ), , 44620-44032, 588.

intellisense. , , , .

, ㄱ, , , 가 깋. 588 . , ㄱ "0",

startCodePoint = index * 588 + 44032
// = 0 * 588 + 44032 == 44032 == 가
endCodePoint = (index + 1) * 588 + 44032
// this will include

, 'ㄱ',

if(charcode >= startCodePoint && charcode < endCodePoint) { ... }

charcode - intellisense.

, , , "가". , .


, .

.

  • (, 각)
  • 44032 .
  • 588.
  • .

.

String initials = "ㄱㄲㄴㄷㄸㄹㅁㅂㅃㅅㅆㅇㅈㅉㅊㅋㅌㅍㅎ";
int value = character.codePointAt(0);
value = (value - 44032) / 588;
String initial = initials.substring(value, 1);
+5

- Unicode int. 16 char.

int codePoint = strng.codePointAt(0);
int indexToRest = Character.charCount(codePoint); // For your information
-1

All Articles