I have the following code that reads a file that has 3 integers in the formats of a single number, or x/y where x is an int as is y.
I'm trying to read the file, then split at each white space in order to isolate each part of the string to end up using "parseInt" to get them into integers. So far I have
BufferedReader br = new BufferedReader(new FileReader("input1.txt"));
String line = br.readLine();
while (line != null){
String[] lines = line.split(" ");
I assume after this it should look something like this as an example
lines[0] = 4
lines[1] = 4/2
Looking at this I assume I can parse each part using lines[1] etc
So my Question is how I can check for a "/" since i won't be able to use parseInt if it has a dash. I assumed something like and if statement, if lines has "/" etc... but i wasn't sure of the Syntax,
Any help would be appreciated,
Regards,
James