使用 StringFormat.SetTabStops() 是否可以对齐制表符?

发布于 2024-10-09 04:15:39 字数 99 浏览 0 评论 0 原文

我希望能够对齐在 StringFormat 中使用的制表位(使用 SetTabStops() 方法设置)

这可能吗?

I'd like to be able to align the tabstops I use in a StringFormat (set with the SetTabStops() method)

Is this possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

薄情伤 2024-10-16 04:15:39

请参阅(更新:根据下面的评论没有多大帮助)


或者,正如我进一步评论并自己推荐的那样:)

在 String.Format 中,我不这么认为,因为它专门用于用不同的格式化程序替换 {n} 部分。您可以做的一件事是用 '\t' 分割字符串,然后对每个字符串应用 .PadLeft() 或 .PadRight() ,然后对它们应用 string.Join() ,或者使用上面的任何建议,但是, string.Format 可能是这个的死胡同。

See (Update: Didn't help much as per comments below)


Or, as I commented further and recommend by yourself :)

In String.Format I don't think so as all it specializes in is replacing {n} parts with different formatters. One thing you may be able to do is to split the string by '\t', and apply .PadLeft() or .PadRight() to each and then string.Join() them, or use any of the suggestions above, but, string.Format is likely dead end for this one.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文