File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes has contain method for String? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "has contain method for String?" Watch "has contain method for String?" New topic

has contain method for String?

sam cen

Joined: Nov 10, 2002
Posts: 5
How do test whether a string contain charater 'a' or 'b' for example?
just want to check with all of you about, does JKD provide contain method for Sting,
Or I need to do coding for this.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

indexOf will return the index of the first position of the character, or -1 if it was not found.
Jessica Sant

Joined: Oct 17, 2001
Posts: 4313

Check out the JDK 1.4 API for more details.
And remember the String class is immutable, so if you're doing a lot of String manipulation, the StringBuffer class is much more efficient and better suited.
I agree. Here's the link:
subject: has contain method for String?
It's not a secret anymore!