📄 main.pas
字号:
unit main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, math, Spin,HDCompressUtils;
type
TFrmMain = class(TForm)
Memo1: TMemo;
Memo2: TMemo;
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FrmMain: TFrmMain;
implementation
{$R *.dfm}
{ TForm1 }
function HexStrToStr(const S:string):string;
//16进制字符串转换成字符串
var
t:Integer;
ts:string;
M,Code:Integer;
begin
t:=1;
Result:='';
while t<=Length(S) do
begin
while not (S[t] in ['0'..'9','A'..'F','a'..'f']) do
inc(t);
if (t+1>Length(S))or(not (S[t+1] in ['0'..'9','A'..'F','a'..'f'])) then
ts:='$'+S[t]
else
ts:='$'+S[t]+S[t+1];
Val(ts,M,Code);
if Code=0 then
Result:=Result+Chr(M);
inc(t,2);
end;
end;
function StrToHexStr(const S:string;NoBlack:Boolean=False):string;
//字符串转换成16进制字符串
var
I:Integer;
begin
for I:=1 to Length(S) do
begin
if I=1 then
Result:=IntToHex(Ord(S[1]),2)
else begin
if NoBlack then
Result:=Result+IntToHex(Ord(S[I]),2)
else Result:=Result+' '+IntToHex(Ord(S[I]),2);
end;
end;
end;
procedure TFrmMain.Button1Click(Sender: TObject);
var
S:string;
begin
S:=Memo1.Lines.Text;
//if CheckBox1.Checked then
//S:=HexStrToStr(Trim(S));
Edit1.Text:=IntToStr(Length(S));
S:=RAYCompress(S);
Memo2.Text:=StrToHexStr(S);
Edit2.Text:=IntToStr(Length(S));
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -