DelphiBasics
AnsiLeftStr
Function
Extracts characters from the left of a string StrUtils unit
 function AnsiLeftStr ( const Source : AnsiString; const Count : Integer ) : AnsiString;
Description
The AnsiLeftStr extracts characters from the left of a string.
 
It attempts to return the leftmost Count characters from Source.
 
If Count exceeds the size of the source, the whole of source is returned.
Related commands
AnsiMidStr Returns a substring from the middle characters of a string
AnsiRightStr Extracts characters from the right of a string
Trim Removes leading and trailing blanks from a string
TrimLeft Removes leading blanks from a string
TrimRight Removes trailing blanks from a string
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.




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

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