Innspection for String.indexOf(char)
Hi,
I'm wondering if it makes sense to add an inspection that finds
String.indexOf(char) != -1 and String.indexOf(char) == -1 ... those
expressions can be written more clearly as String.contains(char) and
!String.contains(char) since 1.5.
What do yo think?
Please sign in to leave a comment.
Don't forget the 'string.indexOf(chr) < 0' statements.
Tom
Sounds useful. Please submit a request.
Bas
Michael Riess wrote:
Thomas Singer schrieb:
Yes ... <= -1, < 0 and > -1 can also be replaced.
BTW: >= -1 can be replaced by TRUE, and < -1 can be replaced by FALSE. ;)
Oh my so much syntactical variations.
Here's another one: Much of our code is using
indexOf() >= 0
All of these variations reinforce the need for the inspection...
Michael Riess wrote:
>> Don't forget the 'string.indexOf(chr) < 0' statements.
>>
>> Tom
And the url for the request so we can vote for it ;)
BoD
Bas Leijdekkers wrote:
>> Hi,
>>
>> I'm wondering if it makes sense to add an inspection that finds
>> String.indexOf(char) != -1 and String.indexOf(char) == -1 ... those
>> expressions can be written more clearly as String.contains(char) and
>> !String.contains(char) since 1.5.
>>
>> What do yo think?
I submitted my first request ... hopefully it's a good one! ;)
http://www.jetbrains.net/jira/browse/IDEADEV-2333
>> Sounds useful. Please submit a request.
>>
>> Bas
>>
>> Michael Riess wrote:
>>
>>> Hi,
>>>
>>> I'm wondering if it makes sense to add an inspection that finds
>>> String.indexOf(char) != -1 and String.indexOf(char) == -1 ... those
>>> expressions can be written more clearly as String.contains(char) and
>>> !String.contains(char) since 1.5.
>>>
>>> What do yo think?