DelphiBasics
TrimRight
Function
Removes trailing blanks from a string SysUtils unit
1  function TrimRight ( const Text : String ) : String;
2  function TrimRight ( const Text : WideString ) : WideString;
Description
The TrimRight function removes blank and control characters (such as line feed) from the end of a string.
Related commands
Delete Delete a section of characters from a string
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
Trim Removes leading and trailing blanks from a string
TrimLeft Removes leading 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 : 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 2002 - 2016. All rights reserved.  |  Home Page