假设我们的字符串是 -
string str ="9999";
现在,使用 Int32.Parse() 将字符串转换为整数 -
int n = Int32.Parse(str);
现在显示整数值,如以下代码所示 -
using System; class Demo { static void Main() { string str ="9999"; int n = Int32.Parse(str); Console.WriteLine(n); } }
以上就是C#中如何将字符串转换为int?的详细内容,更多请关注php中文网其它相关文章!
已抢65124个
抢已抢28572个
抢已抢15448个
抢已抢7750个
抢已抢9652个
抢已抢19642个
抢