我在c#中需要一些东西,就像c ++中的setw()一样 [英] I need something in c# which work like the setw() in c++
本文介绍了我在c#中需要一些东西,就像c ++中的setw()一样的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在c#中使用richTextBox.我需要在一个richTextBox中显示不同长度的字符串,但是这些字符串应该完全对齐.
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
我知道如何使用setw函数在c ++中执行此操作.但是我在c#中找不到等效项.
I know how to do this in c++ using the setw function.. but I could not find an equivalent in c#.
推荐答案
You could do use String.PadRight
innerString.PadRight(10);
这篇关于我在c#中需要一些东西,就像c ++中的setw()一样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文