📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
txtInput: TEdit;
cmdCalc: TButton;
txtFind: TEdit;
txtANSI: TEdit;
txtWide: TEdit;
cmdClose: TButton;
procedure cmdCalcClick(Sender: TObject);
procedure cmdCloseClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
//以下程序将字符串中的字符的编码一一找出
procedure TForm1.cmdCalcClick(Sender: TObject);
var
InputStr,FindStr:String;
InputStrW,FindStrW:WideString;
begin
//分别指定String及WindeString
InputStr:=txtInput.Text;
InputStrW:=txtInput.Text;
FindStr:=txtFind.Text;
FindStrW:=txtFind.Text;
//使用Pos函数计算结果
txtANSI.Text:=IntToStr(Pos(FindStr,InputStr));
txtWide.Text:=IntToStr(Pos(FindStrW,InputStrW));
end;
procedure TForm1.cmdCloseClick(Sender: TObject);
begin
Close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -