An ``++indexOf++`` or ``++lastIndexOf++`` call with a single letter ``++String++`` can be made more performant by switching to a call with a ``++char++`` argument.


== Noncompliant Code Example

----
String myStr = "Hello World";
// ...
int pos = myStr.indexOf("W");  // Noncompliant
// ...
int otherPos = myStr.lastIndexOf("r"); // Noncompliant
// ...
----


== Compliant Solution

----
String myStr = "Hello World";
// ...
int pos = myStr.indexOf('W'); 
// ...
int otherPos = myStr.lastIndexOf('r');
// ...
----


ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]
