string class : PadEnd(int,string) method

Description

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

Syntax

stringInstance.PadEnd(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.PadEnd(5,"x"); // The result (newString) is "sample stringxxxxx".

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.