String string = ... // irgendein String
if( string.contains( "Bube" ){
...
}
else{
...
}
meez hat gesagt.:mit indexOf() bekommst du sogar den genauen Ort...
Zudem gibts contains erst seit 1.5...(Also so gut wie unbrauchbar...)
meez hat gesagt.:mit indexOf() bekommst du sogar den genauen Ort...
Zudem gibts contains erst seit 1.5...(Also so gut wie unbrauchbar...)
Mr.Q hat gesagt.:Ja das ist zum Kotzen! Immer diese Hinweise, nimm das neuste vom neusten! Bei mir auf der Arbeit gibts kein 1.5, da alte Macs am Start sind...!!! Ich könnte kotzen!
/**
* Returns true if and only if this string contains the specified
* sequence of char values.
*
* @param s the sequence to search for
* @return true if this string contains <code>s</code>, false otherwise
* @throws NullPointerException if <code>s</code> is <code>null</code>
* @since 1.5
*/
public boolean contains(CharSequence s) {
return indexOf(s.toString()) > -1;
}