function Untie(pwd1:string):string;
var i:integer;
pwd2:string;
begin
pwd2:='';
i:=1;
while i<=length(pwd1) do
begin
pwd2:=pwd2+chr(trunc(ord(pwd1)/2)+ord(pwd1[i+1])-48);
i:=i+2;
end;
result:=pwd2;
end;
那我这个该怎么改?
定义
function Untie(pwd1: PChar)Char;
var i:integer;
pwd2:string;
TempPwd1 : String;
begin
if pwd1 = Nil then
TempPwd1 := ''
else
TempPwd1 := String(pwd1);
pwd2:='';
i:=1;
while i<=length(pwd1) do
begin
pwd2:=pwd2+chr(trunc(ord(pwd1)/2)+ord(pwd1[i+1])-48);
i:=i+2;
end;
result:= PChar(pwd2);
end;
定义
function Untie(pwd1: PChar)Char;
var
i:integer;
pwd2:string;
TempPwd1 : String;
begin
if pwd1 = Nil then
TempPwd1 := ''
else
TempPwd1 := String(pwd1);
pwd2:='';
i:=1;
while i<=length(TempPwd1) do
begin
// 不好意思,,, 这里不记的修改
pwd2:=pwd2+chr(trunc(ord(TempPwd1)/2)+ord(TempPwd1[i+1])-48);
i:=i+2;
end;
result:= PChar(pwd2);
end