How to pad a string right with specific character in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main()
    {
        string s = "c#"; 
        char pad_char = '*'; 
        
        Console.WriteLine("{0}", s.PadRight(5, pad_char)); 
    }
}



/*
run:

c#***

*/

 



answered Apr 19, 2019 by avibootz
...