I have a problem in finding the right way to only get city1, city 2 and the distance without the "km", using a scanner and delimiter. I need to get the text in bold.
String (example):
city1, country; city2, country; 145 km
My Delimitar so far because I really have no idea:
scanner.useDelimiter(";");
I also tried using string.split("") without success.
Should I first devide it in 3 parts on the ";" and do a new delimitar for each part? Or is there an easier way?
Thanks in advance
(Edit to explain difference to another post: I tried it with regex, with also no luck. I need to split the string on multiple places on different characters. I wouldn't ask a question if I'm able to solve it with another post.)