SmartPascal
AnsiReverseString
Function
Reverses the sequence of letters in a string StrUtils unit
 function AnsiReverseString ( const Source : AnsiString ) : AnsiString;
Description
The AnsiReverseString function returns the Source string with its characters reversed.
Related commands
AnsiLeftStr Extracts characters from the left of a string
AnsiMidStr Returns a substring from the middle characters of a string
AnsiRightStr Extracts characters from the right of a string
 
Example code : A simple example
// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.
 
unit Unit1;
 
interface
 
uses
  StrUtils,   // Unit containing the AnsiReverseString command
  Forms, Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;
 
var
  
Form1: TForm1;
 
implementation
{$R *.dfm} // Include form definitions
 
procedure TForm1.FormCreate(Sender: TObject);

var
  source, target : AnsiString;
begin
  source := '123456789';
  target := AnsiReverseString(source);

  ShowMessage('Source = '+source);
  ShowMessage('Target = '+target);
end;
 
end.
Hide full unit code
   Source = 123456789
   Target = 987654321