简体   繁体   English

Int32.Parse(“356882”) 生成异常 System.FormatException: '输入字符串的格式不正确。'

[英]Int32.Parse(“356882”) generate exception System.FormatException: 'Input string was not in a correct format.'

I am trying to parse a string in c# but I am getting a format exception, the code I am using is:我正在尝试解析 c# 中的字符串,但出现格式异常,我使用的代码是:

int test;
test =Int32.Parse("356882");

I don't get why this generates an error, 356882 is an integer within the boundaries of an int32.我不明白为什么这会产生错误,356882 是 int32 边界内的 integer。

Any idea?任何想法?

Cheers干杯

Vincent文森特

356882 is an integer 356882 是 integer

Yes, it would be an integer.是的,它将是 integer。 "356882" is an integer. “356882”是 integer。

But this is not what you are parsing.但这不是您要解析的内容。 Yor string is:你的字符串是:

"356882" “356882”

There is a hidden fist character.有一个隐藏的拳头字符。 I copy pasted it from your text - my right key hangs one press.我从您的文本中复制粘贴了它-我的右键挂起一按。 That hidden character is blocking parsing.那个隐藏的字符正在阻止解析。

Now sure how it ends up there - copy/paste and what editor?现在确定它是如何结束的 - 复制/粘贴和什么编辑器?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 异常详细信息:System.FormatException:输入字符串的格式不正确。 解析不起作用 - Exception Details: System.FormatException: Input string was not in a correct format. Parse not working System.FormatException:输入字符串的格式不正确。 c# - System.FormatException: Input string was not in a correct format. c# System.FormatException: '输入字符串的格式不正确。' - System.FormatException: 'Input string was not in a correct format.' System.FormatException: '输入字符串的格式不正确。' 数据网格 - System.FormatException: 'Input string was not in a correct format.' data grid System.FormatException:'输入字符串的格式不正确。 - System.FormatException: 'The input string does not have the correct format.' System.FormatException: '输入字符串的格式不正确。' WinForms - System.FormatException: 'Input string was not in a correct format.' WinForms Linq 错误输入字符串的格式不正确。 System.Exception {System.FormatException} - Linq Error Input string was not in a correct format. System.Exception {System.FormatException} double.parse System.FormatException: '输入字符串的格式不正确。' - double.parse System.FormatException: 'Input string was not in a correct format.' c# 如何修复:“未处理的异常:System.FormatException:输入字符串的格式不正确。” - c# How Can I Fix: “Unhandled Exception: System.FormatException: Input string was not in a correct format.” uint.Parse 对有效字符串抛出 System.FormatException:“输入字符串的格式不正确。” - uint.Parse on a valid string throws System.FormatException: 'Input string was not in a correct format.'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM