'String.indexOf()' expression can be replaced with 'contains()'
Reports comparisons with String.indexOf()
calls that can be replaced with a call to the String.contains()
method.
Example:
boolean b = "abcd".indexOf('e') >= 0;
After the quick-fix is applied:
boolean b = "abcd".contains('e');
This inspection only reports if the language level of the project or module is 5 or higher.
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |
Last modified: 13 July 2023