ePrivacy and GPDR Cookie Consent by CookieConsent.com
menu

Dart strings contains() method

Definition and usage

contains() method in dart is used for checking string, character if they are present or not in another string.
This method returns true if the match found otherwise return false.
The contains() method is CASE-SENSITIVE.

Syntax

string.contains(Pattern search_string, [int startIndex = 0]);

Parameter value


+---------------+--------------------------------------------------------------+
| Parameter     | Deiscription                                                 |
+---------------+--------------------------------------------------------------+
| search_string | Required! This tells the method what to match in the string. |
|               | This can be a string type or any regex(Pattern type).        |
+---------------+--------------------------------------------------------------+
| startIndex    | Optional! This parameter the is used for specifying          |
|               | from where we want to search the string Default value is 0.  |
|               | This is always a integer type.                               |
+---------------+--------------------------------------------------------------+

Technical details


+-------------+-------------------------------------------+
| Return type | Bool! This methods returns true or false. |
+-------------+-------------------------------------------+


Example


Comments