?? rc_codecs.pas
字號:
unit rc_codecs;
interface
uses sysutils;
function rc_Decode(sCoded: string): string;
function rc_Encode(sString: string): string;
implementation
function rc_Decode(sCoded: string): string;
var
i,j,c: integer;
sRes: string;
begin
sRes:= '';
i:= 1;
j:= length(sCoded);
while i<= j do
begin
if ((sCoded[i]= '%') and ((j-i)>1)) then
try
c:= strtoint('$'+copy(sCoded,i+1,2));
sRes:= sRes+ chr(c);
i:= i+ 2;
except
sRes:= sRes+ sCoded[i];
end
else
sRes:= sRes+ sCoded[i];
inc(i);
end;
result:= sRes;
end;
function rc_Encode(sString: string): string;
var
i,j: integer;
sRes: string;
begin
sRes:= '';
j:= length(sString);
for i:= 1 to j do
if ((sString[i]= '*') or (sString[i]= '-') or (sString[i]= '.') or (sString[i]= '_') or (sString[i]= '@')
or ((sString[i]>= 'A') and (sString[i]<= 'Z')) or ((sString[i]>= 'a') and (sString[i]<= 'z'))
or ((sString[i]>= '0') and (sString[i]<= '9'))) then
sRes:= sRes+ sString[i]
else
sRes:= sRes+ format('%%%.2X',[ord(sString[i])]);
result:= sRes;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -