How to pad the end of a string with spaces in C#

1 Answer

0 votes
using System;
 
class Program
{
    static void Main() {
        string s = "c# pro";
         
        Console.Write(s.PadRight(15));
        Console.WriteLine("|");   
    }
}
  
  
  
  
/*
run:
  
c# pro         |
  
*/

 



answered Nov 22, 2021 by avibootz

Related questions

1 answer 163 views
1 answer 162 views
1 answer 148 views
1 answer 224 views
1 answer 159 views
1 answer 219 views
1 answer 154 views
...