String replaceFirstMapped(
Pattern from,
String replace(Match match),
[int startIndex = 0]
)

Replace the first occurence of from in this string.

Returns a new string, which is this string except that the first match of pattern, starting from startIndex, is replaced by the result of calling replace with the match object.

If the value returned by calling replace is not a String, it is converted to a String using its toString method, which must then return a string.

Source

/**
 * Replace the first occurence of [from] in this string.
 *
 * Returns a new string, which is this string
 * except that the first match of [pattern], starting from [startIndex],
 * is replaced by the result of calling [replace] with the match object.
 *
 * If the value returned by calling `replace` is not a [String], it
 * is converted to a `String` using its `toString` method, which must
 * then return a string.
 */
String replaceFirstMapped(Pattern from, String replace(Match match),
                          [int startIndex = 0]);