public static String grabLastInLinePassedScore(String text,String key) throws IOException {
  int scorePos=text.indexOf("Score");
  if (scorePos == -1)   throw new IOException("Token not found: 'Score'");
  int end=text.lastIndexOf(key);
  if (end == -1)   throw new IOException("Token not found: '" + key + "'");
  if (end < scorePos)   throw new IOException("Token not found before 'Score': '" + key + "'");
  end=text.indexOf("\n",end);
  if (end == -1)   end=text.length() - 1;
  while (end > 0 && Character.isWhitespace(text.charAt(end)))   end--;
  int start=end;
  while (start > 0 && !Character.isWhitespace(text.charAt(start)))   start--;
  start+=1;
  return text.substring(start,end + 1);
}

public static String grabLastInLinePassedScore ( String text , String key ) throws IOException { int scorePos = text . indexOf ( "Score" ) ; if ( scorePos == - 1 ) throw new IOException ( "Token not found: 'Score'" ) ; int end = text . lastIndexOf ( key ) ; if ( end == - 1 ) throw new IOException ( "Token not found: '" + key + "'" ) ; if ( end < scorePos ) throw new IOException ( "Token not found before 'Score': '" + key + "'" ) ; end = text . indexOf ( "\n" , end ) ; if ( end == - 1 ) end = text . length ( ) - 1 ; while ( end > 0 && Character . isWhitespace ( text . charAt ( end ) ) ) end -- ; int start = end ; while ( start > 0 && ! Character . isWhitespace ( text . charAt ( start ) ) ) start -- ; start += 1 ; return text . substring ( start , end + 1 ) ; }
grab the last token of the last line that contains the given key and is passed the first occurrence of " score "
