find and solve || findandsolve.com
Please wait.....

C# String PadRight()

In C#, PadRight() is a string method which is used to left-aligns the characters in String by padding them with spaces or specified character on the right, for a specified total length which method can be overloaded by passing different parameters to it.

Method

public string PadRight(Int32 length)  

public string PadRight(Int32, Char)  

Parameter

length: it is an integer type parameter.

Return

It returns a string.

C# String PadRight() Method Example

    using System;
    public class StringPadRightExample     {
        public static void Main(string[] args)
        {
           string str= "Hello word#";
           string str1= str.PadRight(15);
           Console.Write(str1);
           Console.Write("FindAndSolve");
       }

    }    

Output

Hello word#              FindAndSolve