Home About Rice Downloads Documents Others Cooker CookerGX
Documents  >  Class  >  string  >  PadStart(int)
string class : PadStart(int) method

Description

It returns a new string that is added blanks of the specified length to the top of the caller string.

Syntax

stringInstance.PadStart(int length)

Arguments

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

Return value

ClassDescription
stringA new string that is added blanks of the specified length to the top of the caller string.

Sample code

1:

string str = "sample string";

2:

string newString = str.PadStart(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.