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

Method equalsHexCaseInsensitive

lib/java/net/URI.java:1015–1039  ·  view source on GitHub ↗
(String first, String second)

Source from the content-addressed store, hash-verified

1013 * occur in pairs as above
1014 */
1015 private boolean equalsHexCaseInsensitive(String first, String second) {
1016 if (first.indexOf('%') != second.indexOf('%')) {
1017 return first.equals(second);
1018 }
1019
1020 int index = 0, previndex = 0;
1021 while ((index = first.indexOf('%', previndex)) != -1
1022 && second.indexOf('%', previndex) == index) {
1023 boolean match = first.substring(previndex, index).equals(
1024 second.substring(previndex, index));
1025 if (!match) {
1026 return false;
1027 }
1028
1029 match = first.substring(index + 1, index + 3).equalsIgnoreCase(
1030 second.substring(index + 1, index + 3));
1031 if (!match) {
1032 return false;
1033 }
1034
1035 index += 3;
1036 previndex = index;
1037 }
1038 return first.substring(previndex).equals(second.substring(previndex));
1039 }
1040
1041 /**
1042 * Compares this URI instance with the given argument {@code o} and

Callers 1

equalsMethod · 0.95

Calls 4

equalsIgnoreCaseMethod · 0.80
indexOfMethod · 0.65
equalsMethod · 0.65
substringMethod · 0.45

Tested by

no test coverage detected