W3cubDocs

/Dart 2

indexOf method

int indexOf (Pattern pattern, [ int start ])

Returns the position of the first match of pattern in this string, starting at start, inclusive:

var string = 'Dartisans';
string.indexOf('art');                     // 1
string.indexOf(new RegExp(r'[A-Z][a-z]')); // 0

Returns -1 if no match is found:

string.indexOf(new RegExp(r'dart'));       // -1

start must be non-negative and not greater than length.

Implementation

int indexOf(Pattern pattern, [int start]);

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