Menu

#181 rule: String.indexOf is positive

open
nobody
None
5
2013-02-16
2011-01-24
No

RV: Method checks to see if result of String.indexOf is positive (RV_CHECK_FOR_POSITIVE_INDEXOF)

The method invokes String.indexOf and checks to see if the result is positive or non-positive. It is much more typical to check to see if the result is negative or non-negative. It is positive only if the substring checked for occurs at some place other than at the beginning of the String.

Discussion


Log in to post a comment.