Help - get a value values from a text file.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bringabeeralong
    New Member
    • Jul 2007
    • 1

    Help - get a value values from a text file.

    Slowly going out of my mind trying to find out how to do this, as you may have guessed i am quite new to java.

    i have a text file which contains a list of values, on each line there is a string value and a double seperated by a comma, these relate to a raw material and its price, the file has 100+ such lines.

    what i need to do is to match the string value which my program spits out with a string value in the file and then use the double value on that line to set the material price in my program.

    the values need to be in a text file as the material prices change quite often and i don't want to keep updating the program all the time.

    sound simple, but i can't find any info in any of the books i have looked at or on the net, can anyone help before i go insane????

    many thank

    Andy
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Haver a look at the Scanner class and pay special attention to the
    useDelimeter(), next() and nextDouble() methods.

    kind regards,

    Jos

    Comment

    Working...