String.lastIndexOf documentation should clarify what position is returned #41893
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
library-core
type-documentation
A request to add or improve documentation
https://api.dart.dev/stable/2.8.2/dart-core/String/lastIndexOf.html states:
Is
'foobar'.lastIndexOf('foo')
supposed to return 0 or 2?I think that this would be clearer as something like "Returns the starting position".
Additionally, the examples unfortunately happen to use search patterns that match only a single character. The lone example that uses a longer search pattern is for a case where the string isn't found. Changing the examples to use longer search patterns also would clarify the expected behavior.
The text was updated successfully, but these errors were encountered: