$C8F6..$CBF9:result:='S';(3f8f.c)
Delphi数据库拼音搜索方案-将汉字转换为拼音
昨晚在Delphi上看到了汉字->拼音,如何将拼音转换成汉字呢。我的数据库:通讯簿软件没有拼音搜索功能。结果,到了12点也没有结果!啊!
中午你可以找到输入拼音搜索汉字,数据库里怎么实现哪个。2小时,没有果实!
今天的实施:
1.首先创建词典
实现是通过迂回策略根据数据库汉字的读取->拼音的转换->拼音检索结果->实现数据库的拼音检索实现的,在数据库中直接检索,找不到显示结果的方法。
以下附上Code。
1.字库代码:
{//汉字拼音文字检索对应拼音文字}
begin
case WORD shl 8+WORD 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:=;
end;
end;
2.查询实现部分:
{查找汉字拼音代码}
var
zzchar :string;
begin
begin
for j:=1 to Length do
begin
end;
end;
end;
{********************************************************************}
*2.功能:本单元为该数据库程序的汉字拼音检索单元。
*6.编制日期:2008.04.15}
{********************************************************************}
uses
type
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
public
end;
var
{在此定义函数}
{$R *.dfm}
{//汉字拼音文字检索对应拼音文字}
begin
case WORD shl 8+WORD 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:=;
end;
end;
{查找汉字拼音代码}
var
zzchar :string;
begin
begin
for j:=1 to Length do
begin
end;
end;
end;
var
begin
begin
//循环输入
begin
end;
end;
end;
//实现点击选择性名称
begin
end;
{输入拼音查找汉字}
var
SelStr:string;
begin
SelStr:='';
end;
{单击选择}
begin
end;
end。
1c
发表评论