System.SysUtils.TStringHelper.PadRight
Delphi
function PadRight(TotalWidth: Integer): string; overload; inline;
function PadRight(TotalWidth: Integer; PaddingChar: Char): string; overload; inline;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.SysUtils.pas | System.SysUtils | TStringHelper |
Description
Left-aligns a string into a fixed length text space.
var
MyString1: String;
MyString2: String;
begin
MyString1 := '12345';
MyString2 := '123';
Writeln(MyString1.PadRight(5));
Writeln(MyString2.PadRight(5));
end.
Output:
12345 123
There are two PadRight overloaded methods. The first one assumes the pad character is the empty space, while the second one allows you to specify the padding character.