存档

2010年4月 的存档

返回中文汉字拼音函数

2010年4月20日 没有评论

ChinesePY(Source : Text[250]) Result : Text[1024]

//This is created by Yeats.
t1:=127;
targetString:=”;
c[1]:=127;
FOR I:=1 TO STRLEN(Source) DO BEGIN
  EVALUATE(t2,COPYSTR(Source,I,1));
  IF t2<t1 THEN
    targetString:=targetString+COPYSTR(Source,I,1)+c
  ELSE
    targetString:=targetString+COPYSTR(Source,I,1);
END;

FOR I:=1 TO STRLEN(Source) DO BEGIN
  IF Asc(COPYSTR(Source,I,1))>127 THEN BEGIN
    hz:=COPYSTR(Source,I,2);
    h1:=Int2Hex(Asc(hz));
    h2:=Int2Hex(Asc(COPYSTR(hz,2,1)));
    ascNum:=Hex2Int(COPYSTR(h1,1,2)+COPYSTR(h2,1,2));
      IF (ascNum >= Hex2Int(‘B0A1’)) AND (ascNum <= Hex2Int(‘B0C4’)) THEN Result := Result+ ‘a’;
      IF (ascNum >= Hex2Int(‘B0C5’)) AND (ascNum <= Hex2Int(‘B2C0’)) THEN Result := Result+ ‘b’;
      IF (ascNum >= Hex2Int(‘B2C1’)) AND (ascNum <= Hex2Int(‘B4ED’)) THEN Result := Result+ ‘c’;
      IF (ascNum >= Hex2Int(‘B4EE’)) AND (ascNum <= Hex2Int(‘B6E9’)) THEN Result := Result+ ‘d’;
      IF (ascNum >= Hex2Int(‘B6EA’)) AND (ascNum <= Hex2Int(‘B7A1’)) THEN Result := Result+ ‘e’;
      IF (ascNum >= Hex2Int(‘B7A2’)) AND (ascNum <= Hex2Int(‘B8C0’)) THEN Result := Result+ ‘f’;
      IF (ascNum >= Hex2Int(‘B8C1’)) AND (ascNum <= Hex2Int(‘B9FD’)) THEN Result := Result+ ‘g’;
      IF (ascNum >= Hex2Int(‘B9FE’)) AND (ascNum <= Hex2Int(‘BBF6’)) THEN Result := Result+ ‘h’;
      IF (ascNum >= Hex2Int(‘BBF7’)) AND (ascNum <= Hex2Int(‘BFA5’)) THEN Result := Result+ ‘j’;
      IF (ascNum >= Hex2Int(‘BFA6’)) AND (ascNum <= Hex2Int(‘C0AB’)) THEN Result := Result+ ‘k’;
      IF (ascNum >= Hex2Int(‘C0AC’)) AND (ascNum <= Hex2Int(‘C2E7’)) THEN Result := Result+ ‘l’;
      IF (ascNum >= Hex2Int(‘C2E8’)) AND (ascNum <= Hex2Int(‘C4C2’)) THEN Result := Result+ ‘m’;
      IF (ascNum >= Hex2Int(‘C4C3’)) AND (ascNum <= Hex2Int(‘C5B5’)) THEN Result := Result+ ‘n’;
      IF (ascNum >= Hex2Int(‘C5B6’)) AND (ascNum <= Hex2Int(‘C5BD’)) THEN Result := Result+ ‘o’;
      IF (ascNum >= Hex2Int(‘C5BE’)) AND (ascNum <= Hex2Int(‘C6D9’)) THEN Result := Result+ ‘p’;
      IF (ascNum >= Hex2Int(‘C6DA’)) AND (ascNum <= Hex2Int(‘C8BA’)) THEN Result := Result+ ‘q’;
      IF (ascNum >= Hex2Int(‘C8BB’)) AND (ascNum <= Hex2Int(‘C8F5’)) THEN Result := Result+ ‘r’;
      IF (ascNum >= Hex2Int(‘C8F6’)) AND (ascNum <= Hex2Int(‘CBF9’)) THEN Result := Result+ ‘s’;
      IF (ascNum >= Hex2Int(‘CBFA’)) AND (ascNum <= Hex2Int(‘CDD9’)) THEN Result := Result+ ‘t’;
      IF (ascNum >= Hex2Int(‘CDDA’)) AND (ascNum <= Hex2Int(‘CEF3’)) THEN Result := Result+ ‘w’;
      IF (ascNum >= Hex2Int(‘CEF4’)) AND (ascNum <= Hex2Int(‘D188’)) THEN Result := Result+ ‘x’;
      IF (ascNum >= Hex2Int(‘D1B9’)) AND (ascNum <= Hex2Int(‘D4D0’)) THEN Result := Result+ ‘y’;
      IF (ascNum >= Hex2Int(‘D4D1’)) AND (ascNum <= Hex2Int(‘F7F9’)) THEN Result := Result+ ‘z’;
    END;
    I+=1;
END;
Result:=UPPERCASE(Result);

分类: C/AL 标签: ,