<分区>
Possible Duplicate:
How to force a sign when formatting an Int in c#
Format number with + and - sign
我想在有正数或负数时签名(c#):
text = cname + " " + String.Format("{0:0.#}", move) + "% , \n " + text;
我想要正数的格式,如“+2.5%”。 有什么想法吗?
<分区>
Possible Duplicate:
How to force a sign when formatting an Int in c#
Format number with + and - sign
我想在有正数或负数时签名(c#):
text = cname + " " + String.Format("{0:0.#}", move) + "% , \n " + text;
我想要正数的格式,如“+2.5%”。 有什么想法吗?
最佳答案
查看 MSDN:Format Number To Display
string MyString = number.ToString("+#;-#;0");
; - 节分隔符
- 为正数、负数和零数 定义带有单独格式字符串的节。
关于c# - 有符号数 + 或 -,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10811387/
相关文章:
c# - Visual Studio/C# 自动格式化。我可以控制属性后的换行符吗
c# - .NET Math.Log10() 在不同机器上的行为不同
python - 理解字符串格式中的 Python %g,实现 Java String.format 行为
regex - python : extract all placeholders from format string
node.js - 在 Node.js 加密中使用 sign.sign() 时出错,解密错误
c# - 在 Scatterview 中删除已在 C# LibraryStack 中使用的文件