Spec-Zone.ru › Dart 2

dart:core

Метод replaceRange

String replaceRange(
  1. int start,
  2. int? end,
  3. String replacement
)

Заменяет подстроку с start по end на replacement.

Создаёт новую строку, эквивалентную:

this.substring(0, start) + replacement + this.substring(end)

Пример:

const string = 'Dart is fun';
final result = string.replaceRange(8, null, 'open source');
print(result); // Dart is open source

Индексы start и end должны указывать на допустимый диапазон этой строки. То есть 0 <= start <= end <= this.length. Если end равно null, оно по умолчанию равно длине.

Реализация

String replaceRange(int start, int? end, String replacement);

© 2012 the Dart project authors
Licensed under the BSD 3-Clause "New" or "Revised" License.
https://api.dart.dev/stable/2.18.5/dart-core/String/replaceRange.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API