无法将字符串(包含数字)转换为int?

Ahm*_*mad 2 c# string type-conversion

我有一个非常愚蠢的问题..我有一个包含" 800.0000"(没有引号)的字符串,我正在尝试将其转换为数字800.我正在使用此命令,但它不起作用:

int inputNumber = Int32.Parse(inputString);

我得到FormatException,并显示消息"输入字符串格式不正确".

Den*_*nis 11

试试这个:

int inputNumber = Int32.Parse(inputString, NumberStyles.AllowDecimalPoint);
Run Code Online (Sandbox Code Playgroud)