Determine whether a string includes a particular sequence of characters.
String |
The contains() method verifies if a string includes a specific sequence of characters.
It returns true if the characters are found, and false otherwise.
public |
Parameter |
Description |
CharSequence chars |
The characters to search for in the string. |
The CharSequence interface is a readable sequence of char values, found in the java.lang package. |
Returns: |
A boolean indicating whether a sequence of characters exists in the specified string:
|
Throws: |
NullPointerException – if the returned value is null |
Java Version: |
1.5 |