Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 使用多个十进制分隔符进行分析_.net_Parsing_Decimal Point - Fatal编程技术网

.net 使用多个十进制分隔符进行分析

.net 使用多个十进制分隔符进行分析,.net,parsing,decimal-point,.net,Parsing,Decimal Point,根据报告: 应使用第一个十进制分隔符,应忽略后续的十进制分隔符。然而,以下声明 float.Parse("1.000.000", new CultureInfo("en")) 抛出带有消息“输入字符串格式不正确”的FormatException 这是一个bug还是预期的行为?查看上面的项目: //#-数字占位符。如果值为 您引用的文本引用了用于转换为字符串的格式字符串,如 value.ToString("#.###.###"); 它与.Parse()方法无关 该评论位于 // Format

根据报告:

应使用第一个十进制分隔符,应忽略后续的十进制分隔符。然而,以下声明

float.Parse("1.000.000", new CultureInfo("en"))
抛出带有消息“输入字符串格式不正确”的
FormatException


这是一个bug还是预期的行为?

查看上面的项目:

//#-数字占位符。如果值为

您引用的文本引用了用于转换为字符串的格式字符串,如

 value.ToString("#.###.###");

它与
.Parse()
方法无关

该评论位于

// Format strings that do not start with an alphabetic character, or that start
// with an alphabetic character followed by a non-digit, are called
// user-defined format strings. The following table describes the formatting
// characters that are supported in user defined format strings.

这一节讲的是
float.ToString(…)

您正在阅读的注释应该是:“一个字符串的形式:
[ws][sign][integral digits[,]]整数[[小数][e[sign]指数数字][ws]
”,它正好提到了一个小数点符号。这看起来像是我想要的行为。“1.000.000”在英语中根本不是一个有效的数字。看起来它实际上是一个使用
作为千位分隔符的区域设置中的字符串。我遇到过一种情况,同一个字符被用作十进制分隔符和千位分隔符。Windows(以及
CultureInfo
类)也允许这样做。
// Format strings that do not start with an alphabetic character, or that start
// with an alphabetic character followed by a non-digit, are called
// user-defined format strings. The following table describes the formatting
// characters that are supported in user defined format strings.