private static String find(Scanner sc, String pattern) {
String Stoken;
while (( Stoken = sc.findInLine(pattern)) == null) {
if (sc.hasNextLine()) {
sc.nextLine();
} else {
return null;
}
}
return Stoken; // return string that match the pattern
}
I know that somewhere before my data I need to get - i have a pattern -but I want to collect the data I need after the pattern - so maybe if I get the position of the pattern in the scanner I can substring in the scanner and collect what I need - but position is private - do I have a way to know it?
the data is different each time so i can not look for it directly