|
-
September 26th, 2000, 12:08 PM
#1
easy question
I know this is easy.. I am coming to java from a long time in C/C++. How do you easily convert a String to an int? sounds easy right? Well, tell me if you know cause I can't figure it out and the MSDN I have doesn't know either. it is a simple atoi() call in C++, but what about java? I am using MS J++.
thanks java people!
-
September 26th, 2000, 01:16 PM
#2
Re: easy question
Hi, In java we have wrapper classes to do this. If u want to convert to a string to int, do like this...
try
{
String str = "23";
int value = java.lang.Integer.parseInt(str);
System.out.println(val);
}
catch (Exception e) { }
Sreeni
#If this post is valid to u, then dont forget to rate it#
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|