Name: jl125535 Date: 12/11/2002
FULL PRODUCT VERSION :
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)
FULL OPERATING SYSTEM VERSION :
ADDITIONAL OPERATING SYSTEMS :
A DESCRIPTION OF THE PROBLEM :
Quite frequently I would like to check whether one String
contains another as a substring, without caring where the
substring occurs. I can use <code>boolean contains =
(str1.indexOf(str2) > -1);</code>, but this is inelegant,
especially for a frequent idiom. I would prefer a method in
String which checked this for me.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Look through the String API. Observe that none of the
methods with return type boolean do this.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected such a method to exist. It doesn't.
This bug can be reproduced always.
CUSTOMER WORKAROUND :
boolean contains = (str1.indexOf(str2) > -1);
(Alternatively, hack rt.jar, but I don't think the licence
(Review ID: 164276)