replaceAfterFirst method

String replaceAfterFirst(
  1. String pattern,
  2. String replacement
)

Replaces everything after the first occurrence of pattern.

Implementation

String replaceAfterFirst(String pattern, String replacement) {
  final i = indexOf(pattern);
  if (i == -1) return this;
  return substring(0, i + pattern.length) + replacement;
}