Adding whitespaces to a string in C#

前端 未结 4 1791
失恋的感觉
失恋的感觉 2021-01-03 21:58

I\'m getting a string as a parameter.

Every string should take 30 characters and after I check its length I want to add whitespaces to the end of the st

4条回答
  •  我在风中等你
    2021-01-03 22:41

    you can use Padding in C#

    eg

      string s = "Example";
      s=s.PadRight(30);
    

    I hope It should be resolve your Problem.

提交回复
热议问题