replaceFirst abstract method

CharacterRange? replaceFirst(
  1. Characters pattern,
  2. Characters replacement
)

Replaces the first occurrence of pattern with replacement.

Finds the first occurrence of pattern in the current range, then replaces that occurrence with replacement. Then returns a range on the resulting characters which contains the inserted replacement characters and any remaining characters of the original range.

The inserted characters may combine with the preceding or following code points, so that the start and end of the original range are no longer grapheme cluster boundaries. In that case, the returned range may extend into into the code points before and after the original range.

Returns null if there are no occurrences of pattern in the current range.

Implementation

CharacterRange? replaceFirst(Characters pattern, Characters replacement);