Results 1 to 2 of 2
  1. #1
    Thaenor is offline Member
    Join Date
    Dec 2011
    Posts
    1
    Rep Power
    0

    Default 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.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,403
    Rep Power
    25

    Default Re: String managing - retrieving a number from inputted string

    "fetch" the numbers in the middle of the string and use them as floats or int's
    Look at the String class for methods to get substrings out of a String.
    Look at the Integer and Double class for methods to convert/parse Strings into ints or doubles

Similar Threads

  1. Help (Java Eclipse loop using inputted number)
    By micolord in forum New To Java
    Replies: 12
    Last Post: 09-11-2011, 01:23 PM
  2. Help (Java Eclipse loop using inputted number)
    By micolord in forum Eclipse
    Replies: 1
    Last Post: 09-07-2011, 02:45 PM
  3. Retrieving a single value from a String array
    By Karenthian in forum New To Java
    Replies: 5
    Last Post: 04-03-2011, 02:12 AM
  4. String and number formatting
    By computerbum in forum New To Java
    Replies: 1
    Last Post: 04-27-2010, 05:06 PM
  5. convert number to string
    By wizard_oz in forum New To Java
    Replies: 9
    Last Post: 11-16-2009, 07:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •