Alex Rivera | Logout

How can I check if a single character appears in a string?

Asked 2009-02-03T05:38:42.737
296

In Java is there a way to check the condition:

"Does this single character appear at all in string x"

without using a loop?

Edit
Report

1 Answer

2

Yes, using the indexOf() method on the string class. See the API documentation for this method

answered 2009-02-03T05:44:38.357

Your Answer