My Hindi Forum

Go Back   My Hindi Forum > Miscellaneous > Tech Talks
Home Rules Facebook Register FAQ Community

Reply
 
Thread Tools Display Modes
Old 11-12-2009, 03:16 PM   #1
abhishek
Senior Member
 
abhishek's Avatar
 
Join Date: Dec 2009
Posts: 444
Rep Power: 18
abhishek is just really niceabhishek is just really niceabhishek is just really niceabhishek is just really nice
Lightbulb 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);
}

__________________
Join this forum, it's completely free.
abhishek is offline   Reply With Quote
Old 14-12-2009, 11:16 AM   #2
javaguru
Member
 
javaguru's Avatar
 
Join Date: Dec 2009
Posts: 50
Rep Power: 15
javaguru is on a distinguished road
Cool

Good job, you will get more such tips and tricks from me in future. Cheers !!
javaguru is offline   Reply With Quote
Old 22-12-2009, 08:22 PM   #3
javaguru
Member
 
javaguru's Avatar
 
Join Date: Dec 2009
Posts: 50
Rep Power: 15
javaguru is on a distinguished road
Smile

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();
javaguru is offline   Reply With Quote
Reply

Bookmarks

Tags
integers, string


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT +5. The time now is 08:35 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.