lastIndexOf method
The starting position of the last match pattern
in this string.
Finds a match of pattern by searching backward starting at start
:
var string = 'Dartisans'; string.lastIndexOf('a'); // 6 string.lastIndexOf(RegExp(r'a(r|n)')); // 6
Returns -1 if pattern
could not be found in this string.
string.lastIndexOf(RegExp(r'DART')); // -1
If start
is omitted, search starts from the end of the string. If supplied, 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.dart.dev/stable/2.13.0/dart-core/String/lastIndexOf.html