This is a badly named method!
It should be named LeftAlign since this is what it does. When left aligning a string into a fixed length field, pad characters are necessarily going to be needed!
A blank pad character is used unless PadChar is specified.
The string is padded on the right with the pad character to make the whole string length match the required Length.
If the string is already <= Length then it is returned unchanged.
Like a lot of string methods, the string object itself is not affected - the modified string is returned for assignment.|
|Microsoft MSDN Links|
| Author links|
Buy Website Traffic at
Buy Proxies at
|A simple example|
strA, strB : String;
strA := '12345';
strB := strA.PadRight(7);
Console.WriteLine('Default padding to 7 characters = ''' + strB + '''');
strB := strA.PadRight(7, '-');
Console.WriteLine('Padding with ''-'' to 7 characters = ''' + strB + '''');
Default padding to 7 characters = '12345 '|
Padding with '-' to 7 characters = '12345--'