How to get a string between two characters?

There’s probably a really neat RegExp, but I’m noob in that area, so instead…

String s = "test string (67)";

s = s.substring(s.indexOf("(") + 1);
s = s.substring(0, s.indexOf(")"));

System.out.println(s);

Leave a Comment