Click here to Skip to main content
15,894,291 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a string "str1" and the value is given below
C#
string str1= "513442148741311";


How to convert the string value to integer value?

please someone Help me....
Thank-you.....
Posted
Updated 6-Jun-13 21:49pm
v2

You can use BigInteger.TryParse Method[^]. See this:
C#
BigInteger number1;
BigInteger.TryParse("12347534159895123", out number1);
//Now converted number is stored in number1 variable



--Amit
 
Share this answer
 
 
Share this answer
 
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
 
Share this answer
 
string str1= "513442148741311";
int64 str2=convert.ToInt64(str1);
now the string value is converted to int...
thankuuu...
 
Share this answer
 
string str1= "513442148741311";
Convert.toInt64(str1)
 
Share this answer
 
string str1= "513442148741311"; // str1 is string value
int str2=convert.toint32(str1); or
int str2=convert.toint64(str1); // for bigint
str1 string value is converted into integer value str2.
thank u.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900