DELPHI 7 批量修改数据库,如已知字段A中显示的为中文,批量取A字段中中文的拼音存入B字段
3个回答
展开全部
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, XPMan;
type
TForm1 = class(TForm)
Button1: TButton;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
function py(x: string): char;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function TForm1.py(x: string): char;
begin
case word(x[1]) shl 8 + word(x[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(32);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i: integer;
str, s: string;
begin
Edit2.Text := '';
str := Trim(Edit1.Text);
i := 1;
while i <= length(str) do begin
if Ord(str[i]) > $7F then begin
s := copy(str, i, 2);
Edit2.Text := Edit2.Text + py(s);
i := i + 2;
end
else begin
s := copy(str, i, 1);
Edit2.Text := Edit2.Text + s;
i := i + 1;
end;
end;
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, XPMan;
type
TForm1 = class(TForm)
Button1: TButton;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
function py(x: string): char;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function TForm1.py(x: string): char;
begin
case word(x[1]) shl 8 + word(x[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(32);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i: integer;
str, s: string;
begin
Edit2.Text := '';
str := Trim(Edit1.Text);
i := 1;
while i <= length(str) do begin
if Ord(str[i]) > $7F then begin
s := copy(str, i, 2);
Edit2.Text := Edit2.Text + py(s);
i := i + 2;
end
else begin
s := copy(str, i, 1);
Edit2.Text := Edit2.Text + s;
i := i + 1;
end;
end;
end;
end.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Hwnd = Plugin.Window.GetKeyFocusWnd()
Delay 2000
t1=now:t2=now:sj1=0.5:sj2=60
Rem abcc
Delay 20
If DateDiff("s",t1,now)>=sj1
Delay 10
Call Plugin.Bkgnd.KeyPress(Hwnd, 83)
Delay 10
t1=now
End If
If DateDiff("s",t2,now)>=sj2
Delay 10
Call Plugin.Bkgnd.KeyPress(Hwnd, 70)
t2=now
End If
Goto abcc
Delay 2000
t1=now:t2=now:sj1=0.5:sj2=60
Rem abcc
Delay 20
If DateDiff("s",t1,now)>=sj1
Delay 10
Call Plugin.Bkgnd.KeyPress(Hwnd, 83)
Delay 10
t1=now
End If
If DateDiff("s",t2,now)>=sj2
Delay 10
Call Plugin.Bkgnd.KeyPress(Hwnd, 70)
t2=now
End If
Goto abcc
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
循环
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询