Movatterモバイル変換


[0]ホーム

URL:


menu
  1. Dart
  2. dart:core
  3. String
  4. lastIndexOf abstract method
lastIndexOf
description

lastIndexOf abstract method

intlastIndexOf(
  1. Patternpattern, [
  2. int?start
])

The starting position of the last matchpattern in this string.

Finds a match of pattern by searching backward starting atstart:

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

Returns -1 ifpattern could not be found in this string.

const string = 'Dartisans';print(string.lastIndexOf(RegExp(r'DART'))); // -1

Ifstart is omitted, search starts from the end of the string.If supplied,start must be non-negative and not greater thanlength.

Implementation

int lastIndexOf(Pattern pattern, [int? start]);
  1. Dart
  2. dart:core
  3. String
  4. lastIndexOf abstract method
String class

[8]ページ先頭

©2009-2025 Movatter.jp