core.splitn
Home > @medplum/core > splitN
splitN() function
Splits a string into an array of strings using the specified delimiter. Unlike the built-in split function, this function will split the string into a maximum of exactly n parts. Trailing empty strings are included in the result.
Signature:
export declare function splitN(str: string, delim: string, n: number): string[];
Parameters
Parameter | Type | Description |
---|---|---|
str | string | The string to split. |
delim | string | The delimiter. |
n | number | The maximum number of parts to split the string into. |
Returns:
string[]
The resulting array of strings.