我要把汉字的拼音首字母写到数据库里,以方便检索
解决方案 »
- delphi7 如何取本地时间
- 动态创建cxgrid 退出的时候报错
- delphi 新手学习方面问题。请指教
- delphi 中在一个类中加过程出错?
- bmp.loadfromfile 载入一BMP后使用 bmp.width=bmp.width*3增加了宽度,如何使其中原有图像位于中间呢?
- “文件或目录E:已损坏且无法读取。请运行Chkdsk工具。”--help me
- 请教,为什么sendmessage发送TVM_SELECTITEM消息,告诉没定义。
- 如何使用JPG文件来实现MDI窗体的背景图片,并实现平铺与居中等功能?(200)
- 怎样让子窗口在程序一运行就停泊在指定的地方?
- 在标题栏显示按钮,最小化的时候它会在当前操作窗口的标题栏右上角显示
- 窗体主菜单隐藏问题?
- 求救关于异构表导入的问题,解决马上散分。
begin
Result := char(0);
case WORD(cs[1]) * 256 + WORD(cs[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..$D188 : Result := 'X';
$D1B9..$D4D0 : Result := 'Y';
$D4D1..$D7F9 : Result := 'Z';
end;
end;
Function GetPY(const HZString: string): string;
var I,L:integer;
mystr:string;
begin
mystr:=HZString;
mystr:=RemoveInvalid(' ',mystr); //删除空格
L:=length(mystr)-length(widestring(mystr)); //汉字个数
For I:=1 to L do
result:=result+ GetPYChar(copy(mystr,2*i-1,2));end;//单汉字首拼音字母
Function GetPYChar(const hzchar: string): char;
begin
case Word(hzchar[1]) shl 8 + Word(hzchar[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..$D188: result := 'X';
$D1B9..$D4D0: result := 'Y';
$D4D1..$D7F9: result := 'Z';
else
result := char(0);
end;
end;