Skip to content

kumo.string.replacen(STRING, FROM, TO, COUNT)

Since: Version 2024.09.02-c5476b89

The functionality described in this section requires version 2024.09.02-c5476b89 of KumoMTA, or a more recent version.

Replaces the first N matches of FROM with TO and returns the resulting string.

assert(
  kumo.string.replacen('foo foo 123 foo', 'foo', 'new', 2)
    == 'new new 123 foo'
)