在c#中格式化打印 [英] Formating printing in c#

查看:194
本文介绍了在c#中格式化打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



请告诉我们如何为每个列字符串指定起点和终点。

例如我有4列。日期,特别是借记,余额。所以就像日期应该是0-10,然后特别是12-40这样..

请告诉我怎么能这样做..

解决方案

有很多方法可以做到这一点。一种方法是:



string str = String.Format({0,-10} {1,30},日期,特别)



详情:



http://msdn.microsoft.com/en-us/library/system.string.format(v=vs.110).aspx [ ^ ]

Hi all

Please tell how to assign a starting and ending point for each column string.
e.g i have 4 columns. Date, particular, debit, balance. So like date should be from 0-10, then particular 12-40 like this..
please tell me how can i do this..

解决方案

There are numerous ways to do this. One way would be:

string str = String.Format ("{0,-10} {1,30}", date, particular)

Details:

http://msdn.microsoft.com/en-us/library/system.string.format(v=vs.110).aspx[^]


这篇关于在c#中格式化打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆