Javatpoint Logo
Javatpoint Logo

C# String PadLeft()

The C# PadLeft() method is used to get a new string that right-aligns the characters in this string if the string length is less than the specified length.

For example, suppose you have "hello C#" as the string which has 8 length of characters and you are passing 10 for the padleft, it shifts the string at right side after two whitespaces. It means PadLeft() method provides padding to the string for the specified length. It is used for formatting string content.

Signature

Parameter

length: it is an integer type parameter which is used to pass padding.

Return

It returns string.


C# String PadLeft() Method Example

Output:

  Hello C#





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA