string class : PadEnd(int) method
Description
It returns a new string that is added blanks of the specified length to the end of the caller string.
Syntax
stringInstance.PadEnd(int length)
Arguments
Class | Name | Description |
int | length | The length of the blanks to be added to the end. |
Return value
Class | Description |
string | A new string that is added blanks of the specified length to the end of the caller string. |
Sample code
1: | string str = "sample string"; |
2: | string newString = str.PadEnd(5); // The result (newString) is "sample string ". |
Notes
An UnknownException (ArgumentOutOfRangeException) is thrown if you specify a value less than zero for the argument.
Links for reference
None.