根据Reference Source :
// . - Decimal point. The first '.' character
// in the format string determines the location of the decimal separator in the
// formatted value; any additional '.' characters are ignored. The actual
// character used as a the decimal separator in the output string is given by
// the NumberFormatInfo used to format the number.
应使用第一个小数分隔符,随后的小数分隔符应被忽略。但是,下面的语句
float.Parse("1.000.000", new CultureInfo("en"))
抛出 FormatException
并显示消息“输入字符串的格式不正确”。
这是一个错误还是预期的行为?
最佳答案
查看上面的项目:
// # - Digit placeholder. If the value being
您引用的文本是指用于将转换为字符串的格式字符串,例如
value.ToString("#.###.###");
它与 .Parse()
方法无关。
关于.net - 使用多个小数点分隔符进行解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35599803/