Skip to content

kumo.string.splitn(STRING, LIMIT, PATTERN)

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.

Splits STRING by PATTERN, returning an array-style table holding at most LIMIT substrings.

assert(
  kumo.json_encode(kumo.string.splitn('Mary had a little lamb', 3, ' '))
    == '["Mary","had","a little lamb"]'
)