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

ClassNameDescription
intlengthThe length of the blanks to be added to the end.

Return value

ClassDescription
stringA 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.

Copyright © Rice All rights reserved.