MCPcopy Create free account
hub / github.com/davidgiven/luje / regionMatches

Method regionMatches

lib/java/lang/String.java:1209–1227  ·  view source on GitHub ↗

Compares the specified string to this string and compares the specified range of characters to determine if they are the same. @param thisStart the starting offset in this string. @param string the string to compare. @param start the starting offset in the specified

(int thisStart, String string, int start,
            int length)

Source from the content-addressed store, hash-verified

1207 * if {@code string} is {@code null}.
1208 */
1209 public boolean regionMatches(int thisStart, String string, int start,
1210 int length) {
1211 if (string.count - start < length || start < 0) {
1212 return false;
1213 }
1214 if (thisStart < 0 || count - thisStart < length) {
1215 return false;
1216 }
1217 if (length <= 0) {
1218 return true;
1219 }
1220 int o1 = offset + thisStart, o2 = string.offset + start;
1221 for (int i = 0; i < length; ++i) {
1222 if (value[o1 + i] != string.value[o2 + i]) {
1223 return false;
1224 }
1225 }
1226 return true;
1227 }
1228
1229 /**
1230 * Compares the specified string to this string and compares the specified

Callers 4

endsWithMethod · 0.95
startsWithMethod · 0.95
contentEqualsMethod · 0.95
parseMethod · 0.80

Calls 2

toUpperCaseMethod · 0.95
toLowerCaseMethod · 0.95

Tested by

no test coverage detected