Get the pinyin letter of a Chinese character

xiaoxiao2021-03-06  57

Function Geten (CNSTRING: STRING): String;

Function getenchar (cnchar: string): char;

? begin

??? Case Word (cnchar [1]) SHL 8 Word (cnchar [2]) of

????? $ b0a1 .. $ b0c4: result: = 'a';

????? $ b0c5 .. $ b2c0: result: = 'b';

????? $ b2c1 .. $ b4ed: result: = 'c';

????? $ b4ee .. $ b6e9: result: = 'd';

????? $ b6ea .. $ b7a1: result: = 'e';

????? $ b7a2 .. $ b8c0: result: = 'f';

????? $ b8c1 .. $ b9fd: result: = 'g';

????? $ b9fe .. $ bbf6: result: = 'h';

????? $ bbf7 .. $ bfa5: result: = 'j';

????? $ bfa6 .. $ c0Ab: result: = 'k';

????? $ c0ac .. $ c2e7: result: = 'l';

????? $ c2e8 .. $ c4c2: result: = 'm';

????? $ c4c3 .. $ c5b5: result: = 'n';

????? $ c5b6 .. $ c5bd: result: = 'o';

????? $ c5be .. $ c6d9: result: = 'p';

????? $ c6da .. $ c8ba: result: = 'q';

????? $ c8bb .. $ c8f5: result: = 'r';

????? $ c8f6 .. $ CBF9: Result: = 's';

????? $ cbfa .. $ cdd9: result: = 't';

????? $ cdda .. $ CEF3: Result: = 'W';

????? $ CEF4 .. $ D1B8: Result: = 'x';

????? $ d1b9 .. $ d4d0: result: = 'y';

????? $ d4d1 .. $ d7f9: result: = 'z';

??? ELSE

????? result: = char (0);

???

? End;

VAR

? i, len: integer;

Begin

? Cnstring: = StringReplace (cnstring, '', '', [rfreplaceAll]) ;? // Delete space

? len: = length (cnstring) - length (wideString (cnstring)); ??????? // Chinese characters

? for i: = 1 to Len do

??? Result: = Result getenchar (CNString, 2 * i-1, 2));

END;

转载请注明原文地址:https://www.9cbs.com/read-118668.html

New Post(0)