Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/redundantStringOperation/afterSubstringEquals.java
Tagir Valeev 25dc0f385c s.substring(s.length()-fooLen).equals(foo) -> s.endsWith(foo)
GitOrigin-RevId: 5dbd78e6359770f9680ef25dcf699297b5a28e46
2019-11-24 02:05:56 +00:00

15 lines
549 B
Java

// "Fix all 'Redundant String operation' problems in file" "true"
class X {
void test(String s, int pos, String s2) {
if (s.startsWith("xyzt", pos)) { }
if (s.substring(pos, pos + 5).equals("xyzt")) { }
if (s.startsWith(s2, pos)) { }
if (s.startsWith(s2, pos)) { }
if (s.substring(pos, pos + pos).equals(s2)) { }
if (s.startsWith("xyzt")) { }
if (s.startsWith("xyzt", 1)) { }
if (s.startsWith("xyzt", 1)) { }
if (s.endsWith("...")) {}
if (s.endsWith(s2)) {}
}
}