public static int indexOfIgnoreCase(String src,String sub,int startIndex,int endIndex){
  if (startIndex < 0) {
    startIndex=0;
  }
  int srclen=src.length();
  if (endIndex > srclen) {
    endIndex=srclen;
  }
  int sublen=sub.length();
  if (sublen == 0) {
    return startIndex > srclen ? srclen : startIndex;
  }
  sub=sub.toLowerCase();
  int total=endIndex - sublen + 1;
  char c=sub.charAt(0);
  mainloop:   for (int i=startIndex; i < total; i++) {
    if (Character.toLowerCase(src.charAt(i)) != c) {
      continue;
    }
    int j=1;
    int k=i + 1;
    while (j < sublen) {
      char source=Character.toLowerCase(src.charAt(k));
      if (sub.charAt(j) != source) {
        continue mainloop;
      }
      j++;
      k++;
    }
    return i;
  }
  return -1;
}

public static int indexOfIgnoreCase ( String src , String sub , int startIndex , int endIndex ) { if ( startIndex < 0 ) { startIndex = 0 ; } int srclen = src . length ( ) ; if ( endIndex > srclen ) { endIndex = srclen ; } int sublen = sub . length ( ) ; if ( sublen == 0 ) { return startIndex > srclen ? srclen : startIndex ; } sub = sub . toLowerCase ( ) ; int total = endIndex - sublen + 1 ; char c = sub . charAt ( 0 ) ; mainloop : for ( int i = startIndex ; i < total ; i ++ ) { if ( Character . toLowerCase ( src . charAt ( i ) ) != c ) { continue ; } int j = 1 ; int k = i + 1 ; while ( j < sublen ) { char source = Character . toLowerCase ( src . charAt ( k ) ) ; if ( sub . charAt ( j ) != source ) { continue mainloop ; } j ++ ; k ++ ; } return i ; } return - 1 ; }
finds first index of a substring in the given source string and range with ignored case .
