contains method

bool contains (
  1. Pattern other,
  2. [int startIndex = 0]
)

Whether this string contains a match of other.

Example:

var string = 'Dart strings';
string.contains('D');                     // true
string.contains(RegExp(r'[A-Z]'));    // true

If startIndex is provided, this method matches only at or after that index:

string.contains('D', 1);                  // false
string.contains(RegExp(r'[A-Z]'), 1); // false

The startIndex must not be negative or greater than length.

Implementation

bool contains(Pattern other, [int startIndex = 0]);

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-core/String/contains.html