在数值中设置点而不是逗号 [英] Set up dot instead of comma in numeric values

查看:19
本文介绍了在数值中设置点而不是逗号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有新的 XmlDocument 对象,例如xml 是在我的程序中创建的...

I have new XmlDocument object, i.g. xml is created during my program...

我希望创建的 xml 中的所有数值默认都带有点符号而不是逗号.

I want all numeric values in created xml was with dot symbol instead of comma by default.

我可以做一些事情来声明一次,而不是解析每个十进制值吗?

Can I do something to declare it once, not to parse every decimal value?

即在开始的某个地方设置这个点而不是逗号并且直到最后都不担心这个?

I.e. To set up this dot instead of comma somewhere in the beginning and don't worry about this till the end?

推荐答案

试试这个:

System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
customCulture.NumberFormat.NumberDecimalSeparator = ".";

System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;

这篇关于在数值中设置点而不是逗号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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