Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/redundantStringOperation/afterSubstringEquals.java
Tagir Valeev 476b3ff5bb substring(x, x+y.length()).equals(y) -> startsWith(y, x) (IDEA-226148, case#1)
GitOrigin-RevId: 04fe1be3e9f48783ad8d95897497ea55109453f5
2019-11-22 06:36:34 +00:00

13 lines
484 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)) { }
}
}