I'm facing a little problem when getting all the strings between two delimiters.
As I saw on other related questions, (one of) the way to get characters between two delimiters is as follow:
Given some string, in my example here "void foo(int a, int b) {", I want to get every char between the parentheses.
Using:
String parameters = currLine.trim().substring(currLine.indexOf("("),
currLine.indexOf(")")-1);
Where currLine is of course "void foo(int a, int b) {".
Now everything works perfectly, since I get the "int a, int b" strings.
The problem is that with a string like the following:
void foo ( int a , String b ) {
I get that:
parameters = "nt a , String b ) "
And I have no idea how to fix this without causing it problems to the first case.