Reverse String

Reverse String

function Reverse(str : String) : String;
var
i, l : integer;
begin
// Result has the same length as original string
Result := str;

l := length (str);

for i := 1 to l do
begin
Result[l – i + 1] := str[i];
end;
end;