EDIT------------- Seems my explanation wasn't all that good so here is a better one of what I need to do. Here is an example file(ignore the space between lines):
10=android|156.94.34.212|Device 1|5|9
15=IOS|134.58.48.343|Data|3|7
I want to parse each line. I need to store each part of the line excluding the "=" and the "|" characters and the last 2 numbers are also irrelevant. So the 5,9,3 and 7 I don't need. My problem is when I come across Device 1. I need to save that space and the 1 but can't figure out how. This would be what I need to show for the first line:
id = 10
device = android
ipAddress = 156.94.34.212
deviceName = device 1
Sample Code:
Scanner scan = new Scanner(file);
while(scan.hasNextLine()){
Scanner id = new Scanner(scan.next()).useDelimiter("=");
String deviceID = id.next();
Scanner dataScan = new Scanner(id.next()).useDelimiter("[|]");
String device = dataScan.next();
String address = dataScan.next();
String deviceName = dataScan.next();
scan.nextLine();
}
Printout leaves off the 1 in "device 1" everything else parses correctly.