交换。我的代码中有一个 [英] Swap . out with one , in my code

查看:92
本文介绍了交换。我的代码中有一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在网站上显示一些数字时,它必须是这样的。当我有一个丹麦网站时会反过来显示。



我试图看看这里,我已经完成了已经显示但没有运气。



https://msdn.microsoft.com/en-us/library/dwhawy9k%28v=vs.110%29.aspx



我写了这样的代码



When I show some numbers appear on the website so it must be such that it does. on to when I have a Danish website which will show instead.

I've tried to look here and I have done as has been shown and without luck.

https://msdn.microsoft.com/en-us/library/dwhawy9k%28v=vs.110%29.aspx

I have written my code like this

ButtonPay.Text = "Køb Medlemskab - DKK " + (Convert.ToDouble(200) / 1.30).ToString("F2") + ",- Kr";





当它被写出来时它看起来像这个153.84我可以想象它看起来像这样, - > 153,84



When it was written out so it looks like this 153.84 I could well imagine that it came to look like this, -> 153,84

推荐答案

默认情况下,任何标准格式 [ ^ ]将本地系统用于分隔符等。例如,美国语言环境中的F使用。 (点)和DE(德语)本地使用,(逗号)作为小数分隔符...丹麦语(DK)的默认值也是逗号,所以如果你得到别的东西你可能已经改变了当地人或当地人不是DK而是其他东西...

幸运的是你可以在格式化字符串的同时强制使用本地...

By default any standard formatting[^] uses the system local for separators and such. For instance 'F' in US locale uses . (dot) and in DE (German) local it uses , (comma) as decimal separator...The default for Danish (DK), too is a comma, so if you get something else you may have changed your locals or the local is not DK but something else...
Fortunately you can force a local while formatting strings...
CultureInfo dk = new CultureInfo("da-DK");
(Convert.ToDouble(200) / 1.30).ToString("F2", dk);



至于货币符号'Kr',你应该使用C代替F ...


As for the monetary sign 'Kr', you should use C instead of F...


这篇关于交换。我的代码中有一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆