function GetPYIndexChar(hzchar: string;
IsCharOrNum_Returned: boolean;
IsNullChar_ReturnChar: string): string;
var /// 是数字或英文字母时返回该字母;没有找到时返回的字符
i, n: integer;
c: char;
begin
/// 取得字符串中汉字拼音的第一个字母串
i := 1;
result := '';
while i <= length(hzchar) do
begin
if bytetype(hzchar, i) = mbSingleByte then
begin
if IsCharOrNum_Returned then
result := result + hzchar;
inc(i)
end
else
begin
case WORD(hzchar) shl 8 + WORD(hzchar[i + 1]) of
$B0A1..$B0C4: C := 'A';
$B0C5..$B2C0: C := 'B';
$B2C1..$B4ED: C := 'C';
$B4EE..$B6E9: C := 'D';
$B6EA..$B7A1: C := 'E';
$B7A2..$B8C0: C := 'F';
$B8C1..$B9FD: C := 'G';
$B9FE..$BBF6: C := 'H';
$BBF7..$BFA5: C := 'J';
$BFA6..$C0AB: C := 'K';
$C0AC..$C2E7: C := 'L';
$C2E8..$C4C2: C := 'M';
$C4C3..$C5B5: C := 'N';
$C5B6..$C5BD: C := 'O';
$C5BE..$C6D9: C := 'P';
$C6DA..$C8BA: C := 'Q';
$C8BB..$C8F5: C := 'R';
$C8F6..$CBF9: C := 'S';
$CBFA..$CDD9: C := 'T';
$CDDA..$CEF3: C := 'W';
$CEF4..$D188: C := 'X';
$D1B9..$D4D0: C := 'Y';
$D4D1..$D7F9: C := 'Z';
else
C := char(0);
end;
if c = char(0) then
result := result + IsNullChar_ReturnChar else
result := result + LowerCase(c);
inc(i, 2);
end;
end;
end;