I want to get specific parts of a String like:
@org.junit.runners.Suite$SuiteClasses(value=[class data.XTest
, class data.YTest])
data.XTest and data.YTest are variable.
Whats the best way to get the classes after the class.
Required output:
sTring[0] = data.XTest;
sTring[1] = data.YTest;
How about this one-liner:
This works by first using regex to extract the substring between
"...[class "and"]", then splits on the separating chars to neatly pluck out the target strings.Here’s a test:
Output: