首页 > 代码库 > 反转字符串

反转字符串



function ReverseString(s: string): string;
var
  i: integer;
  s1:string;
begin
  s1 := ‘‘;
  for i := 1 to Length(s) do
    s1 := s[i] + s1;
  Result:=s1;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Memo1.Text := ReverseString(Memo1.Text);
end;


来自为知笔记(Wiz)