DelphiBasics
AnsiRightStr
Function
Extracts characters from the right of a string StrUtils unit
 function AnsiRightStr(const Source AnsiString; const Count Integer):AnsiString;
Description
The AnsiRightStr extracts characters from the right of a string.
 
It attempts to return the rightmost Count characters from Source.
 
If Count exceeds the size of the source, the whole of source is returned.
Related commands
AnsiLeftStrExtracts characters from the left of a string
AnsiMidStrReturns a substring from the middle characters of a string
TrimRemoves leading and trailing blanks from a string
TrimLeftRemoves leading blanks from a string
TrimRightRemoves trailing blanks from a string
 Download this web site as a Windows program.




 
Example code : A simple example
var
  source, target : AnsiString;
begin
  source := '123456789';
  target := AnsiRightStr(source, 3);

  ShowMessage('Source = '+source);
  ShowMessage('Target = '+target);
end;
Show full unit code
  Source = 123456789
  Target = 789
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page