String.Format 和 log.DebugFormat 货币
我正在使用 log4net 输出格式化消息。以下代码的
log.DebugFormat("Balance: {0:c} ", balance);
结果是
“Balance: ¤1,000.00”
为什么出现奇数字符而不是 $
I'm using log4net to output a formatted message. The following code
log.DebugFormat("Balance: {0:c} ", balance);
results in
"Balance: ¤1,000.00"
Why is the odd character appearing and not a $
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想这与您的区域设置有关。
尝试这样的方法:
如果这不起作用,那么您可以随时使用调试器来检查以下值:
System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat;
具体检查以下值:
确保将其设置为“$”符号。
您可能也对此维基百科页面感兴趣:http://en.wikipedia.org/ wiki/Currency_%28typography%29
这解释了您得到的符号是什么。
具体来说:
I would imagine that it is something to do with your regional settings.
Try something like this:
If that dosen't work then you can always use the debugger to check the value of:
System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat;
Specifically check the value of:
To ensure that it's set to the '$' symbol.
You may also be intersted in this wikipedia page: http://en.wikipedia.org/wiki/Currency_%28typography%29
Which explains what the symbol you are getting is.
Specifically: