W3cubDocs

/Dart 2

lastIndexOf method

int lastIndexOf (Pattern pattern, [ int start ])

Returns the position of the last match pattern in this string, searching backward starting at start, inclusive:

var string = 'Dartisans';
string.lastIndexOf('a');                    // 6
string.lastIndexOf(new RegExp(r'a(r|n)'));  // 6

Returns -1 if pattern could not be found in this string.

string.lastIndexOf(new RegExp(r'DART'));    // -1

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

Implementation

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

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-core/String/lastIndexOf.html