double.Parse抛出System.FormatException [英] double.Parse throw a System.FormatException

查看:91
本文介绍了double.Parse抛出System.FormatException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用此解析方法重载将某些字符串解析为双精度值:

I am trying to parse some string to a double value, using this parse method overload:

double.Parse("198.222213745118", CultureInfo.CurrentUICulture);

CultureInfo.CurrentUICulture是fr-FR. 但这会引发FormatException类型的异常.

the CultureInfo.CurrentUICulture is fr-FR. but this is throwing an exception of type FormatException.

可能是什么原因?

推荐答案

法语(即fr-FR)使用逗号表示小数部分的开头,而不是句点.他们用一段时间分隔成千上万.

French (i.e. fr-FR) use a comma to denote the start of the decimal part, not a period. They use a period to separate thousands.

这篇关于double.Parse抛出System.FormatException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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