MCPcopy Create free account
hub / github.com/ReadyTalk/avian / indexOf

Method indexOf

classpath/java/util/regex/TrivialPattern.java:95–111  ·  view source on GitHub ↗
(CharSequence haystack, CharSequence needle, int start)

Source from the content-addressed store, hash-verified

93 }
94
95 static int indexOf(CharSequence haystack, CharSequence needle, int start) {
96 if (needle.length() == 0) return start;
97
98 for (int i = start; i < haystack.length() - needle.length() + 1; ++i) {
99 int j = 0;
100 for (; j < needle.length(); ++j) {
101 if (haystack.charAt(i + j) != needle.charAt(j)) {
102 break;
103 }
104 }
105 if (j == needle.length()) {
106 return i;
107 }
108 }
109
110 return -1;
111 }
112}

Callers 2

findMethod · 0.95
splitMethod · 0.95

Calls 2

lengthMethod · 0.65
charAtMethod · 0.65

Tested by

no test coverage detected