如何将字符串值转换为整数值? [英] how to convert the string value to integer value?
本文介绍了如何将字符串值转换为整数值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个字符串str1,值在下面给出
string str1 = 513442148741311;
如何将字符串值转换为整数值?
请有人帮助我....
谢谢.....
解决方案
你可以使用 BigInteger.TryParse方法 [ ^ ]。见:
BigInteger number1;
BigInteger.TryParse( 12347534159895123, out number1);
// 现在转换的数字存储在number1变量中< br $>
- Amit
使用TryParse方法。< br $> b $ b
http://msdn.microsoft.com /en-us/library/f02979c7.aspx [ ^ ]
http:/ /msdn.microsoft.com/en-us/library/vstudio/bb397679.aspx [ ^ ]
http://msdn.microsoft.com/en-us/library/5kzh1b5w(v = VS.80)的.aspx [<一个HREF =http://msdn.microsoft.com/en-us/library/5kzh1b5w(v=vs.80)。 aspxtarget =_ blanktitle =New Window> ^ ]
确保字符串包含整数范围内的数字
I have a string "str1" and the value is given below
string str1= "513442148741311";
How to convert the string value to integer value?
please someone Help me....
Thank-you.....
解决方案
You can use BigInteger.TryParse Method[^]. See this:
BigInteger number1; BigInteger.TryParse("12347534159895123", out number1); //Now converted number is stored in number1 variable
--Amit
Use the TryParse method.
http://msdn.microsoft.com/en-us/library/f02979c7.aspx[^]
http://msdn.microsoft.com/en-us/library/vstudio/bb397679.aspx[^]
http://msdn.microsoft.com/en-us/library/5kzh1b5w(v=vs.80).aspx[^]
Make sure that the string contains the number within the range of an integer
这篇关于如何将字符串值转换为整数值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文