Regex to split string
I have this code which prints:
[( ?Random =
<http://www.semanticweb.org/vassilis/ontologies/2013/5/Test#Hello> ), (
?Random = <http://www.semanticweb.org/vassilis/ontologies/2013/5/Test#Bye>
)]
I tried to split at [#] but it didnt work.
What should i put in split so that I can get as a result the part after #
only: Hello, Bye
Scanner input = new Scanner(System.in);
final String inputs;
inputs = input.next();
final String[] indices = inputs.split("\\s*,\\s*");
final List<QuerySolution> selectedSolutions = new ArrayList<QuerySolution>(
indices.length) {
{
final List<QuerySolution> solutions = ResultSetFormatter
.toList(results2);
for (final String index : indices) {
add(solutions.get(Integer.valueOf(index)));
}
}
};
System.out.println(selectedSolutions);
No comments:
Post a Comment