vendredi 22 avril 2016

Can one set up an if-statement to search for a certain pattern in a text file?

I am working on a project in java that has to do with fractions. Now in this project, I have to take a list of fractions out of a text file and depending on there line i have to simplify, add, subtract, multiply, and divide them. Part of text file:

-16/6
-7/2
-17
+20 4/2 / +8 4/8
-17/15 + +14/17
+17 5/14 + -2

Now my question is, is there a way to set up an if statement or something to look for "anynumber_/_anynumber" or "anynumber_anynumber/anynumber" when I pull a line out of the text file and read it.

If not, what would be the best way to cut the fractions out?

Aucun commentaire:

Enregistrer un commentaire