I've read on here how to split data from a string and it worked wonders... for the most part.
What I am trying to do is pull data from a credentials file that has four sections on a line seperated by spaces, the username, MD5 hash, plain text password surrounded in ", and finally a role. My issue is that I began using the .split thinking that that would be what I needed, but that third or [2] item of occasionally has a space in it that I need to somehow filter into the split. Any ideas?
An example of the line that gets split from credentialLine:
griffin.keyes 108de81c31bf9c622f76876b74e9285f "alphabet soup" zookeeper
FileInputStream credentialsFile = null;
Scanner inFS = null;
String credFile = ".\\src\\authenticationsystem\\credentials.txt";
System.out.println("\nOpening file credentials.txt");
credentialsFile = new FileInputStream(credFile);
inFS = new Scanner(credentialsFile);
String credentialLine = inFS.nextLine();
System.out.println(credentialLine);
System.out.println("Closing file credentials.txt\n");
credentialsFile.close();
String[] userCreds = credentialLine.split("\\s+");
String userCred = userCreds[0];
String userMD = userCreds[1];
String userPass = userCreds[2];
String userRole = userCreds[3];