Reputation: 543
I'm trying to use the contains method on a string with a single character that i'm supplying. Is there any easy way to do this that i might not be thinking of? or do i have to go through a series of weird casts to get a CharSequence object?
Upvotes: 0
Views: 413
Reputation: 159175
contains(str)
is the same as indexOf(str) != -1
, but indexOf()
also have an overload taking a char
, so use indexOf(ch) != -1
.
Upvotes: 2