DelphiBasics
TrimLeft
Function
Removes leading blanks from a string SysUtils unit
1 function TrimLeft(const Text String):String;
2 function TrimLeft (const Text WideString:WideString;
Description
The TrimLeft function removes blank and control characters (such as line feed) from the start of a string.
Related commands
DeleteDelete a section of characters from a string
AnsiMidStrReturns a substring from the middle characters of a string
AnsiLeftStrExtracts characters from the left of a string
AnsiRightStrExtracts characters from the right of a string
TrimRemoves leading and trailing blanks from a string
TrimRightRemoves trailing blanks from a string
 Download this web site as a Windows program.




 
Example code : Illustrating Trim, TrimLeft and TrimRight
const
  PaddedString = '  Letters     ';
begin
  ShowMessage('[' + TrimLeft(PaddedString)  + ']');
  ShowMessage('[' + TrimRight(PaddedString) + ']');
  ShowMessage('[' + Trim(PaddedString)      + ']');
end;
Show full unit code
  [Letters ]
  [ Letters]
  [Letters]
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page