--> how to Reverse String in Delphi | Delphi Tips Trick

For Newbie

Tuesday 15 November 2011

how to Reverse String in Delphi

| Tuesday 15 November 2011


Function to reverse a String, for example, the string "Delphi" will become "ihpleD".

Function Declaration:
Strback function (IVI: String): String;
var
   l: Integer;
begin
   for i: = Length (IVI) downto 1 do
   begin
     Result: = Result + IVI [l];
   end;
end;

Examples of Implementation:
procedure TForm1.Button1Click (Sender: TObject);
begin
   Edit2.Text: = Strback (Edit1.Text);
end;

Related Posts

No comments: