Slight rehash.
This commit is contained in:
parent
fd8c37c7cb
commit
0d5e3d5ffe
|
@ -41,8 +41,8 @@ public class lab_3 {
|
||||||
public static String compareStrings(StringBuilder builder) {
|
public static String compareStrings(StringBuilder builder) {
|
||||||
for (int leftBoundary = 0; leftBoundary <= builder.length(); leftBoundary++) {
|
for (int leftBoundary = 0; leftBoundary <= builder.length(); leftBoundary++) {
|
||||||
for (int rightBoundary = builder.length(); leftBoundary >= 0; rightBoundary--) {
|
for (int rightBoundary = builder.length(); leftBoundary >= 0; rightBoundary--) {
|
||||||
if (result.equals(builder.substring(leftBoundary, rightBoundary).toString().toLowerCase().replaceAll("[^a-z]",""))) {
|
if (result.equals(builder.substring(leftBoundary, rightBoundary).toLowerCase().replaceAll("[^a-z]",""))) {
|
||||||
return builder.substring(leftBoundary, rightBoundary).toString();
|
return builder.substring(leftBoundary, rightBoundary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue