开发者

C# Double.ToString() [duplicate]

开发者 https://www.devze.com 2023-01-01 07:35 出处:网络
This question already has answers here: 开发者_运维百科 Closed 12 years ago. Possible Duplicate: Custom numeric format string to always display the sign
This question already has answers here: 开发者_运维百科 Closed 12 years ago.

Possible Duplicate:

Custom numeric format string to always display the sign

To format a double to certain precision in C# I write this:

d.ToString("#0.00");

What if I want to force a the sign to appear.. e.g

+2.54 and -2.54


Hope this will work.

YourDoublenumber.ToString("+#;#");
0

精彩评论

暂无评论...
验证码 换一张
取 消