My Hindi Forum

My Hindi Forum (http://myhindiforum.com/index.php)
-   Tech Talks (http://myhindiforum.com/forumdisplay.php?f=20)
-   -   How to convert String to int? (http://myhindiforum.com/showthread.php?t=20)

abhishek 11-12-2009 03:16 PM

How to convert String to int?
 
It is very simple. Let's take an example.

Code:

public static void main(String[] args) {
 
String myString= "100";
int myInt = Integer.parseInt(myString);
   
System.out.println(myInt);
}


:)

javaguru 14-12-2009 11:16 AM

Good job, you will get more such tips and tricks from me in future. Cheers !! :)

javaguru 22-12-2009 08:22 PM

The valueOf() function of Integer class is is used to convert string to Number. Here is the code example:
Code:

String numString = “1000″;
int id=Integer.valueOf(numString).intValue();



All times are GMT +5. The time now is 02:49 PM.

Powered by: vBulletin
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
MyHindiForum.com is not responsible for the views and opinion of the posters. The posters and only posters shall be liable for any copyright infringement.