split function
- String separator,
- IValidator child
Splits a string into a list of substrings.
Splits the input string at each occurrence of the separator
. Fails if the
input value is not a string.
Passes the resulting list of strings to the child
validator.
Example: split(',', listEach(toInt(isGte(0))))
Implementation
IValidator split(String separator, IValidator child) {
return isString() & transform((v) => v.split(separator), child);
}