How can I substring
the third number in the String
below:
String val = "2020202030 or 303030303 or 303033303";
For two numbers the solution is as follows:
String val = "2020202030 or 303030303
firstNumber = val.substring(0,val.indexOf("or")-1);
secondNumber = val.substring(val.indexOf("or") + 3,val.length());
But how can I get the index of the second "or" in the String
below?
String val = "2020202030 or 303030303 or 303033303";
firstNumber = val.substring(0,val.indexOf("or")-1);
secondNumber = val.substring(val.indexOf("or")-1,<index of second or >?);
thirdNumber= val.substring(<index of second or>?,val.length());