Add a refinement for clarity in the RegionMatches function
This commit is contained in:
parent
0e116c9dfb
commit
8ecc31f99e
@ -50,18 +50,9 @@ public class CaseInsensitiveWorkarounds {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean processRegionMatches(String localSrc, String localDest) {
|
public boolean processRegionMatches(String localSrc, String localDest) {
|
||||||
final char firstLo = Character.toLowerCase(localDest.charAt(0));
|
for (int i = localSrc.length() - localDest.length(); i >= 0; i--)
|
||||||
final char firstUp = Character.toUpperCase(localDest.charAt(0));
|
|
||||||
|
|
||||||
for (int i = localSrc.length() - localDest.length(); i >= 0; i--) {
|
|
||||||
final char ch = localSrc.charAt(i);
|
|
||||||
if (ch != firstLo && ch != firstUp)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (localSrc.regionMatches(true, i, localDest, 0, localDest.length()))
|
if (localSrc.regionMatches(true, i, localDest, 0, localDest.length()))
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user