function decode(str: string): string
var
  I: integer;
begin
  result := '';
  for i:=1 to str.length do
  begin
    result := result + char(ord(str[i])-10+1*2);
  end;
end;

解决方案 »

  1.   

    function Decode(Str: string): string;
    var I: integer;
        S:string;
    begin
      result := '';
      for I:=1 to length(Str) do
        S := S + Char(ord(Str[i])-10+1*2);
      result := S;
    end;
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      Edit2.Text:=decode(Edit1.Text);
    end;已检测通过。
      

  2.   

    function Decode(Str: string): string;
    var I: integer;
        S:string;
    begin
      result := '';
      S:='';
      for I:=1 to length(Str) do
        S := S + Char(ord(Str[i])-10+1*2);
      result := S;
    end;加一句代码更好。