全角转半角


function SbctoDbc(s: string): string;
var
nlength, i: integer;
str, ctmp, c1, c2: string;
begin
nlength := length(s);
if (nlength = 0) then
exit;
str := '';
setlength(ctmp, nlength + 1);
ctmp := s;
i := 1;
while (i <= nlength) do
begin
c1 := ctmp[i];
c2 := ctmp[i + 1];
if (c1 = #163) then
begin
str := str + chr(ord(c2[1]) - 128);
inc(i, 2);
continue;
end;
if (c1 > #163) then
begin
str := str + c1;
str := str + c2;
inc(i, 2);
continue;
end;
if (c1 = #161) and (c2 = #161) then
begin
str := str + ' ';
inc(i, 2);
continue;
end;
str := str + c1;
inc(i);
end;
result := str;
end;

上一篇:JAVA计算两个日期相差月数


下一篇:【逆向&编程实战】Metasploit中的安卓载荷凭什么吊打SpyNote成为安卓端最强远控