in src/main/java/org/apache/commons/text/StrBuilder.java [1948:1974]
public int indexOf(final String str, int startIndex) {
startIndex = Math.max(startIndex, 0);
if (str == null || startIndex >= size) {
return -1;
}
final int strLen = str.length();
if (strLen == 1) {
return indexOf(str.charAt(0), startIndex);
}
if (strLen == 0) {
return startIndex;
}
if (strLen > size) {
return -1;
}
final char[] thisBuf = buffer;
final int len = size - strLen + 1;
outer: for (int i = startIndex; i < len; i++) {
for (int j = 0; j < strLen; j++) {
if (str.charAt(j) != thisBuf[i + j]) {
continue outer;
}
}
return i;
}
return -1;
}