Version: v0.5.1 - Beta.  We welcome contributors & feedback.  THanks!

String.contains

contains(match, ignoreCase = false)

Description

Check for the existence of match and return true or false.

match may be a String or a Regex pattern.

'abcdef'.contains('def');
//= true

'abcdef'.contains('xyz');
//= false

'abcdef'.contains('CDE', true);
//= true

Examples of Regex patterns:

'123 456'.contains(r'\d+ \d+');
//= true

'123'.contains(r'[a-z]');
//= false

'Abc 123'.contains(r'abc \d+'.flags('i'));
//= true

See Also