C#StringPadRight

Returns a left-aligned string padded on the right.

Syntax

str.PadRight(totalWidth, paddingChar?)

Example

Enter values below to update the example in real time.

string
code
Console
WriteLine
PadRight
string code = "42";
Console.WriteLine(code.PadRight(5, '0'));   // "42000"