Okay, so this is my predicament, I have two columns in a text file that I want to read. They are for a budget program, so they go like this:
Col 1 Col 2
Savings $100.00 Groceries $100.00 Gas $150 etc. etc.
I want to read these values back into my budget program using a Scanner. However, I only want to read the second column, I want the scanner to skip the first column, always, because I want the numeric values read back into my budget application. Is there some way I can use nextLine() or next() then skip, then nextLine(), then skip, and so on?
You can call next() and discard the result, but that will only work if you are sure about how many tokens you get in each line.
You could split on the dollar sign, then call nextDouible(). Remember you pass the delimiter to the Scanner as a regular expression, so you could use dollar, but that is a meta-character for last character in line, so may have to be escaped like this \\$.
Remember calling nextDouble may leave you with an empty line, as described here.