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
Class | Name | Description |
int | times | Times of repetition |
string | repeatedString | A repeated string. |
Return value
Class | Description |
string | A 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.