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?
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