I have code that reading a file contains multiple square brackets [] in one line, i will take that value (inside square brackets) and will be replaced by another string. The problem is i just got first square brackets value in the line and the others cannot be handled. This is my code :
if (line.contains("[") && line.contains("]")) {
getindex = getIndexContent(line);
}
And the method to get the index value:
String getIndexContent(String str) {
int startIdx = str.indexOf("[");
int endIdx = str.indexOf("]");
String content = str.substring(startIdx + 1, endIdx);
return content;
}
And this is the file contain square brackets that i read:
var[_ii][_ee] = init_value;
Well, i have got the _ii value but how get the _ee that the second value of square brackets? I just imagine that store in Array, but i don't know how?
Thanks.