유돌이

calendar

1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

Notice

2009. 6. 26. 14:01 델파이

function DivHan(Han : String) : String;
const
    ChoSung: WideString = 'ㄱㄲㄴㄷㄸㄹㅁㅂㅃㅅㅆㅇㅈㅉㅊㅋㅌㅍㅎ';
    JungSung: WideString = 'ㅏㅐㅑㅒㅓㅔㅕㅖㅗㅘㅙㅚㅛㅜㅝㅞㅟㅠㅡㅢㅣ';
    JongSung: WideString = ' ㄱㄲㄳㄴㄵㄶㄷㄹㄺㄻㄼㄽㄾㄿㅀㅁㅂㅄㅅㅆㅇㅈㅊㅋㅌㅍㅎ';
var
  i : Integer;
  Temp : WideString;
  WC : Integer;
  IntChoSung, IntJungSung, IntJongSung : Integer;

begin
    Temp := Han;
  for i := 1 to Length(Temp) do
  begin
      WC := Ord(Temp[i]) - $AC00;
    IntChoSung := WC div (21 * 28);
    IntJungSung := (WC Mod (21 * 28)) div 28;
    IntJongSung := WC mod (21 * 28) mod 28;
    Result := Result + ChoSung[IntChoSung + 1] + JungSung[IntJungSung + 1] + JongSung[IntJongSung + 1];
  end;
end;

 

 

예제)

 

procedure TAutoManinForm.Button1Click(Sender: TObject);

begin
  EditHanGul2.Text := DivHan(EditHangle.Text);
end;


'델파이' 카테고리의 다른 글

델파이 단축키  (0) 2009.06.26
델파이에서 case문 사용방법  (0) 2009.06.26
Enter 입력시 Tab효과 주기 In DELPHI  (0) 2009.06.26
StringGrid -> 엑셀 파일로 변환하기  (0) 2009.06.26
엑셀(Excel) 제어하기  (0) 2009.06.26
posted by 유돌이