mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-08 02:58:33 +00:00
Statement unnecessarily nested within else clause.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1586291 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
39168bb734
commit
70d9e8b23d
@ -186,31 +186,30 @@ static boolean regionMatches(final CharSequence cs, final boolean ignoreCase, fi
|
||||
final CharSequence substring, final int start, final int length) {
|
||||
if (cs instanceof String && substring instanceof String) {
|
||||
return ((String) cs).regionMatches(ignoreCase, thisStart, (String) substring, start, length);
|
||||
} else {
|
||||
int index1 = thisStart;
|
||||
int index2 = start;
|
||||
int tmpLen = length;
|
||||
}
|
||||
int index1 = thisStart;
|
||||
int index2 = start;
|
||||
int tmpLen = length;
|
||||
|
||||
while (tmpLen-- > 0) {
|
||||
char c1 = cs.charAt(index1++);
|
||||
char c2 = substring.charAt(index2++);
|
||||
while (tmpLen-- > 0) {
|
||||
char c1 = cs.charAt(index1++);
|
||||
char c2 = substring.charAt(index2++);
|
||||
|
||||
if (c1 == c2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ignoreCase) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// The same check as in String.regionMatches():
|
||||
if (Character.toUpperCase(c1) != Character.toUpperCase(c2)
|
||||
&& Character.toLowerCase(c1) != Character.toLowerCase(c2)) {
|
||||
return false;
|
||||
}
|
||||
if (c1 == c2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return true;
|
||||
if (!ignoreCase) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// The same check as in String.regionMatches():
|
||||
if (Character.toUpperCase(c1) != Character.toUpperCase(c2)
|
||||
&& Character.toLowerCase(c1) != Character.toLowerCase(c2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user