Results 1 to 2 of 2
- 12-15-2011, 12:25 PM #1
Member
- Join Date
- Dec 2011
- Posts
- 1
- Rep Power
- 0
String managing - retrieving a number from inputted string
Grettings, this my first post here, I joined up to ask a little question that I just can't seem to figure out on my own. Perhaps some hints would light me the way.
I'm kinda of a newbie in java. I know a bit of C and the basics of Java.
anyway here's my question.
I'm creating a program where I expect users to input math formulas such as (x,y,z)=(x0,y0,z0)+k(a,b,c)
There are 3 formulas of input and I want the user to be able to choose between the three.
As an example, I will ask which formula does the user want to input and I will choose one. Then he has to input with the defined format like the above mentioned but replacing x0,y0,z0 and a,b,c with numbers.
Is there any function or such where I can "fetch" the numbers in the middle of the string and use them as floats or int's?
thanks.
- 12-15-2011, 12:39 PM #2
Re: String managing - retrieving a number from inputted string
Look at the String class for methods to get substrings out of a String."fetch" the numbers in the middle of the string and use them as floats or int's
Look at the Integer and Double class for methods to convert/parse Strings into ints or doubles
Similar Threads
-
Help (Java Eclipse loop using inputted number)
By micolord in forum New To JavaReplies: 12Last Post: 09-11-2011, 01:23 PM -
Help (Java Eclipse loop using inputted number)
By micolord in forum EclipseReplies: 1Last Post: 09-07-2011, 02:45 PM -
Retrieving a single value from a String array
By Karenthian in forum New To JavaReplies: 5Last Post: 04-03-2011, 02:12 AM -
String and number formatting
By computerbum in forum New To JavaReplies: 1Last Post: 04-27-2010, 05:06 PM -
convert number to string
By wizard_oz in forum New To JavaReplies: 9Last Post: 11-16-2009, 07:04 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks