i have a file.txt like this : 2X^2 + 5X+3=0
i want to save 2 to variable a, 5 to variable b, and 3 to variable c . .
how i can do that . . ?
tanks for your help . .
How do you know if a number is to go to a variable or not?
Your example skips over the second 2 and the 0?
A regular expression might help you extract the numbers from the String you posted.
Also the StreamTokenizer class could work.
You need two steps to do that.
1. Open text file and read content as a string http://www.roseindia.net/java/beginners/java-read-file-line-by-line.shtml
2. search in the string for number you want and assagin value to the correct variable http://www.exampledepot.com/egs/java.lang/SearchString.html
thank for your help . .
We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.