一字段中为某车间人员,怎样录入声母后显示出含有声母的姓名,如录入‘lq’显示李强、李倩等。
解决方案 »
- ★☆★☆★☆★☆TCP通讯问题,特别急!!!!!!!
- 有关API waveOutSetPlaybackRate问题
- 【请高手相助】,在delphi中如何根据传入的classid判断ActiveX是否下载注册?同时,如何获取对应的版本号?【谢谢】
- 怎样实现网络数据库的数据同步
- 怎样用delphi开发出能查看程序登录时‘*****’的具体值?
- 在rave里如何调用delphi下编好的代码来转换报表里的数字小写
- 问题简单,我不会呀?
- 问一个有关于字体的问题?高手请进
- 一个问题,
- 用powerdesigner输出RTF或HTM格式report时,中文出现乱码?高手指点
- 求delphi源代码!!!
- 如何直接读取rar中的文件?(不需要解压的) VC或者Delphi实现最好
function HZToPY(mStr: string): string;
var
i, OIndex: Integer;
IsFlag: Boolean;
const
cMinGBCByte = 161; //最小国标字节
cMaxGBCByte = 254; //最大国标字节
function f(s: string): Integer;
begin
Result := (Ord(s[1]) - cMinGBCByte + 1) * 100 + Ord(s[2]) - cMinGBCByte + 1;
end;
begin
if Length(mStr) < 2 then begin Result := mStr; Exit; end; Result := ''; i := 1; while i <= Length(mStr) do begin if i = Length(mStr) then begin Result := Result + mStr[i]; Break; end; OIndex := f(mStr[i] + mStr[i + 1]); //获取汉字区位码 IsFlag := True; case OIndex of 1601..1636: Result := Result + 'A'; 1637..1832: Result := Result + 'B'; 1833..2078: Result := Result + 'C'; 2079..2273: Result := Result + 'D'; 2274..2301: Result := Result + 'E'; 2302..2432: Result := Result + 'F'; 2433..2593: Result := Result + 'G'; 2594..2786: Result := Result + 'H'; 2787..3105: Result := Result + 'J'; 3106..3211: Result := Result + 'K'; 3212..3471: Result := Result + 'L'; 3472..3634: Result := Result + 'M'; 3635..3721: Result := Result + 'N'; 3722..3729: Result := Result + 'O'; 3730..3857: Result := Result + 'P'; 3858..4026: Result := Result + 'Q'; 4027..4085: Result := Result + 'R'; 4086..4389: Result := Result + 'S'; 4390..4557: Result := Result + 'T'; 4558..4683: Result := Result + 'W'; 4694..4924: Result := Result + 'X'; 4925..5248: Result := Result + 'Y'; 5249..5589: Result := Result + 'Z'; else begin Result := Result + mStr[i]; IsFlag := False; end; end; i := i + 1; if IsFlag then i := i + 1; end;end;
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Label2: TLabel;
Edit2: TEdit;
Label3: TLabel;
procedure Edit1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}Function getPy(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';
$D189..$D4D0:result:='Y';
$D4D1..$D7F9:result:='Z';
ELSE
RESULT:=char(32);
end;
end;procedure TForm1.Edit1Change(Sender: TObject);
var
i:integer;
hz:string;
begin
edit2.Text:='';
for i:=1 to length(edit1.text) div 2 do
begin
hz:=copy(edit1.Text,i*2-1,2);
edit2.Text:=edit2.Text+getpy(hz);
end;
end;end.