/** * Checks if one string contains another starting at a specific index using the * case-sensitivity rule. * <p> * This method mimics parts of {@link String#indexOf(String, int)} * but takes case-sensitivity into account. * * @param str the string to check, not null * @param strStartIndex the index to start at in str * @param search the start to search for, not null * @return the first index of the search String, * -1 if no match or {@code null} string input * @throws NullPointerException if either string is null * @since 2.0 */ public int checkIndexOf(String str, int strStartIndex, String search) { int endIndex = str.length() - search.length(); if (endIndex >= strStartIndex) { for (int i = strStartIndex; i <= endIndex; i++) { if (checkRegionMatches(str, i, search)) { return i; } } } return -1; }