Search code examples
c#alignmentformattingsetw

I need something in c# which work like the setw() in c++


I am using a richTextBox in c#. I need to display strings of different length inside one richTextBox but these strings should be perfectly aligned.. this is an example..

abcd   abcde  abcde
ab     abc    abcdef

I know how to do this in c++ using the setw function.. but I could not find an equivalent in c#.


Solution

  • You could do use String.PadRight

    innerString.PadRight(10);