How to add characters at the end of string until its length is 20?

Hello,

I have a string whose length is always less than 20, lets say 4 “Hell”.

I want to add the symbol blank " " so that the string length will be 20.

So it would be: "Hell "

How can i do it quickly? Thanks!

@EngAnalyst Can you try this :
yourString+String.Concat(Enumerable.Repeat(" ",20-yourString.Length))

1 Like

@EngAnalyst, following is probably easiest way:

stringVariable.PadRight(20, " "c)

Cheers

1 Like