public static int indexOfIgnoreParentheses(char c,String s,int start){
  int level=0;
  for (int i=start; i < s.length(); i++) {
    char other=s.charAt(i);
    if (other == '(') {
      level++;
    }
 else     if (other == ')') {
      level--;
    }
 else     if (other == c && level == 0) {
      return i;
    }
  }
  return -1;
}

public static int indexOfIgnoreParentheses ( char c , String s , int start ) { int level = 0 ; for ( int i = start ; i < s . length ( ) ; i ++ ) { char other = s . charAt ( i ) ; if ( other == '(' ) { level ++ ; } else if ( other == ')' ) { level -- ; } else if ( other == c && level == 0 ) { return i ; } } return - 1 ; }
returns the position of the first occurrence of the given character found in s starting at start . ignores text within pairs of parentheses . returns - 1 if no occurrence is found .
