For Newbie

Tuesday, 15 November 2011

how to Reverse String in Delphi



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;

Share on Facebook
Share on Twitter
Share on Google+

Related : how to Reverse String in Delphi