jodd-core/src/main/java/jodd/util/StringUtil.java
public static int lastIndexOf(final String src, final 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);
		}
		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 (src.charAt(i) != c) {
				continue;
			}
			int j = 1;
			int k = i + 1;
			while (j < sublen) {
				if (sub.charAt(j) != src.charAt(k)) {
					continue mainloop;
				}
				j++; k++;
			}
			return i;
		}
		return -1;
	}
public static int lastIndexOf(final String src, final 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);
		}
		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 (src.charAt(i) != c) {
				continue;
			}
			int j = 1;
			int k = i + 1;
			while (j < sublen) {
				if (sub.charAt(j) != src.charAt(k)) {
					continue mainloop;
				}
				j++; k++;
			}
			return i;
		}
		return -1;
	}
public static int lastIndexOf ( final String src , final 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 ) ; } 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 ( src . charAt ( i ) != c ) { continue ; } int j = 1 ; int k = i + 1 ; while ( j < sublen ) { if ( sub . charAt ( j ) != src . charAt ( k ) ) { continue mainloop ; } j ++ ; k ++ ; } return i ; } return - 1 ; }
Finds last index of a substring in the given source string in specified range [end, start]
See {@link #indexOf(String, String, int, int)}  for details about the speed.

@param src		source to examine
@param sub		substring to find
@param startIndex	starting index
@param endIndex		end index
@return last index of founded substring or -1 if substring is not found
Finds last index of a substring in the given source string in specified range [ end start ] See { @link #indexOf ( String String int int ) } for details about the speed .