| Author |
String contains problem
|
Balachandran Paranjothimani
Ranch Hand
Joined: Jun 18, 2005
Posts: 43
|
|
|
I am on JDK 1.4 and I would like to know if there is a substitute for contains method found in String class in JDK 1.5. TIA.
|
Moderator : <a href="http://groups.yahoo.com/group/OOAD_UML/" target="_blank" rel="nofollow">http://groups.yahoo.com/group/OOAD_UML/</a><br />Home : <a href="http://www.zepho.com" target="_blank" rel="nofollow">http://www.zepho.com</a>
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32833
|
|
You could try the indexOf("abc") method. If you get a number it is in there; if it is not found you get -1. But what is wrong with the contains() method? CR
|
 |
Balachandran Paranjothimani
Ranch Hand
Joined: Jun 18, 2005
Posts: 43
|
|
Nothing is wrong with contains. The deployment is targeted for WAS 6.0 which supports J2EE 1.4. String contains method is available only in Java 5. Your code works. I did see that contains has the same implementation but just overlooked to pass the string to be tested. Thanks.
|
 |
 |
|
|
subject: String contains problem
|
|
|