Inspectopedia
 
2024.3

'String.indexOf()' expression can be replaced with 'contains()'

Warning
New
Last modified: 03 December 2024

Reports comparisons with String.indexOf() calls that can be replaced with a call to the String.contains() method.

Example:

After the quick-fix is applied:

This inspection only reports if the language level of the project or module is 5 or higher.