Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to return the next indexOf after a previous?

For example:

str = "(a+b)*(c+d)*(e+f)"
str.indexOf("(") = 0
str.lastIndexOf("(") = 12

How to get the index in second bracket? (c+d) <- this

like image 926
rustock Avatar asked Apr 24 '13 11:04

rustock


1 Answers

int first  = str.indexOf("(");
int next = str.indexOf("(", first+1);

have a look at API Documentation

like image 121
wrm Avatar answered Oct 14 '22 12:10

wrm