question: public static int lastIndexOfIgnoreCase ( String src , String sub , int startIndex , int endIndex ) { int sublen = sub . length ( ) ; int srclen = src . length ( ) ; if ( sublen == 0 ) { return startIndex > srclen ? srclen : ( startIndex < - 1 ? - 1 : startIndex ) ; } sub = sub . toLowerCase ( ) ; int total = srclen - sublen ; if ( total < 0 ) { return - 1 ; } if ( startIndex >= total ) { startIndex = total ; } if ( endIndex < 0 ) { endIndex = 0 ; } char c = sub . charAt ( 0 ) ; mainloop : for ( int i = startIndex ; i >= endIndex ; 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 ; }
target:  Finds last index of a substring in the given source string with ignored case in specified range.