I have this following string
String oldStr = ".abc.def.ghi.klm.";
How do I retrieve the substring and put into another string using a loop?
for (int i = 0; i < oldStr.length(); ++i) {
String newStr = doSomethingMethod("oldStr");
}
where oldStr should be "abc", "def", "ghi", "klm" recursively
I tried to use StringUtils.subStringBetween(oldStr, ".", ".") but that only handle the first substring. Any help is greatly appreciated.