I have a string something like
(D@01)5(D@02)14100319530033M(D@03)1336009-A-A(D@04)141002A171(D@05)1(D@06)
Now i want to get substring between (D@01)5(D@02)
If i have something like
(D@01)5(D@02)
i can get detail with
quantity = content.substring(content.indexOf("(D@01)") + 6, content.indexOf("(D@02)"));
But somethings D@02 can be different like @05, Now how can i use simple (D@ to get string in between. there are multiple repetitions of (D@
Basically this is what i want to do
content.substring(content.indexOf("(D@01)") + 6, content.nextOccurringIndexOf("(D@"));
String#splitand pass it\(D@[0-9]+\)as the regular expression, this would at least allow you to get the data between the(@D*)blocks...indexOfpublic int indexOf(String str, int fromIndex);MatcherAPI which will give more information...