How to find certain words in a text file, then find numbers in Java? -
i have following text file (answers.txt):
problem a: 23|47|32|20
problem b: 40|50|30|45
problem c: 5|8|11|14
problem d: 20|23|25|30
what need read problem tell it(problem a, problem b), read numbers after it, separated lines, , print out this:
answers problem a: a.23 b.47 c.32 d.20
does know how can done? i've been stuck on while.
read lines 1 one, split lines @ " " first. array 3 parts "problem", "a:" , "23|47|32|20". split third part @ "|" second array 4 parts "23,"47","32","20".
combine output want.
if want info on how read lines file, or spilt strings there billions of tutorials online on how wont go detail on how done. im sure can find them.
Comments
Post a Comment