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

Description

It concatenates a string that specified string has been repeated a specified number of times to the top of caller string and returns it as new string.

Syntax

stringInstance.PadStart(int times, string repeatedString)

Arguments

ClassNameDescription
inttimesTimes of repetition
stringrepeatedStringA repeated string.

Return value

ClassDescription
stringA concatenated string.

Sample code

1:

string str = "sample string";

2:

string newString = str.PadStart(5,"x"); // The result (newString) is "xxxxxsample string".

Notes

An UnknownException (ArgumentOutOfRangeException) is thrown if you specify a value less than zero for the first argument.

Links for reference

None.

Copyright © Rice All rights reserved.