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.



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


It returns string.

C# String PadLeft() Method Example


  Hello C#

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA