function PadLeft(const TotalWidth: Integer; const PaddingChar: Char = ' '): Substr.Substring;
The text padded on the left with PaddingChar to TotalWidth characters.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | TotalWidth | Integer | |
| 2 | PaddingChar | Char |
Returns: Substring - The padded value, or the text itself as a part when it is TotalWidth wide already.
Remarks:
A negative TotalWidth raises ESubstringRangeError.
Examples
Leading zeros.
uses Substr;
procedure Example;
begin
Assert(Substring('7').PadLeft(3, '0') = '007');
end;