C# string formatting and padding

后端 未结 2 1527
青春惊慌失措
青春惊慌失措 2021-01-19 05:15

Seems like this should be something straightforward, but I haven\'t been able to get it right. I\'ve looked at http://idunno.org/archive/2004/14/01/122.aspx for reference.

2条回答
  •  爱一瞬间的悲伤
    2021-01-19 05:35

    useful

    |{0,-10:0.00}| => |87,87 | - With "-" => padRight

    |{0,10:0.000}| => | 87,878| - Without "-" => padLeft

    |{3,-10:0.###}| - ### - prints numbers after decimal "," only if it is meaningful (not 0): 87,8000 =>87,8

提交回复
热议问题