需要格式化数据的帮助 [英] Need help in formatting the data
本文介绍了需要格式化数据的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
以下是我用于格式化数据的行
Hi all
Below is the line i am using to format the data
strline = string.Format("{0,-3}", co.ToString()) +
String.Format("{0,-19:dd MMM yyyy}", ds.Tables[0].Rows[i][1]) +
string.Format("{0,-30}", per1) +
string.Format("{0,-40}", ds.Tables[0].Rows[i][3].ToString()) +
string.Format("{0,-50}", ds.Tables[0].Rows[i][5].ToString()) +
Math.Round(d, 2) +
string.Format("{0,-60}", ds.Tables[0].Rows[i][6].ToString()) +
Math.Round(d1, 2) +
string.Format("{0,-80}", ds.Tables[0].Rows[i][7].ToString());
但我得到的输出是
but the output i am getting is
1 07 Aug 2012 By IB-2012220152498-cash 0 0.0000 0.0010938.0000 10938.0044929.00
我无法分开
I am not able to separate
0.0010938.0000 10938.0044929.00
它应该是这样的
it should come like this
0.00 10938.0000 10938.00 44929.00
样本数据
Sample Data
Date Particulars ChequeNo Withdrawals Deposits Balance
-------------------- ----------------------------------- -------- ----------------- -------------------- ---------------
1 07 Aug 2012 By IB-2012220152498-cash 0 0 10938 44929.00
2 07 Aug 2012 To Cash 0 20000 0 24929.00
3 08 Aug 2012 To SI TD/RD/89 8000 0 16929.00
4 09 Aug 2012 To Cash 0 5000 0 11929.00
5 14 Aug 2012 To Cash 0 11000 0 929.00
6 22 Aug 2012 By OUTSTN ALLOW FRM 8/8/1 0 0 25676 26605.00
7 24 Aug 2012 To ABB GMD SB/GEN(SB)/840 0 100 0 26505.00
8 08 Sep 2012 To SI TD/RD/89 8000 0 18505.00
9 14 Sep 2012 By Cash 0 0 14640 33145.00
10 15 Sep 2012 To Cash 0 10000 0 23145.00
11 30 Sep 2012 By Half Yearly Interest 0 1397 24542.00
12 05 Oct 2012 To Cash 0 4000 0 20542.00
13 05 Oct 2012 By Cash 0 0 13582 34124.00
图片链接
[IMG] http://i57.tinypic.com/x6bu5w.jpg [/ IMG]
请告诉我这里有什么问题
Image link
[IMG]http://i57.tinypic.com/x6bu5w.jpg[/IMG]
Please tell me what wrong here
推荐答案
你必须将Math.Round(d1,2)放入String.Format中:
You have to put Math.Round(d1, 2) into String.Format too:
String.Format("{0, -70}", math.round(d1,2))
除了-55(或其他)之外,d相同
Same for d except with -55 (or whatever)
这篇关于需要格式化数据的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文