I have a string that reads like this
"Anderson, T",CWS,SS,123,498,81,167,32,0,18,56,15,109,17,5,0.335,0.357,0.508,0.865
I need to extract each part. Ive already parsed the fist three string ("Anderson, T", CWS, SS) but now i need to extract 123 and im having some trouble doing it. The way I did it for the first three fields is i just used line.split
public static String parsePOS(String line) {
String[] tokens = line.split(",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)");
return tokens[2];
}
But I cannot use line.split with an int array. Can anyone help me out?
Thanks!
SSand123, they are both just a sequence of characters in a string. If you want to get the123value as anintvalue, first get the text fromtokens[3], nottokens[2], then convert the string value to anintvalue by callingInteger.parseInt(s)