Appearance
split
Type Aliases
TSplitter
ts
type TSplitter = (src) => string[];Defined in: src/split/splitProvider.ts:6
A function that splits a string into an array of strings.
Parameters
| Parameter | Type |
|---|---|
src | string |
Returns
string[]
Variables
NATIVE_SPLIT
ts
const NATIVE_SPLIT: {
(separator, limit?): string[];
(splitter, limit?): string[];
};Defined in: src/split/splitProvider.ts:1
Call Signature
ts
(separator, limit?): string[];Split a string into substrings using the specified separator and return them as an array.
Parameters
| Parameter | Type | Description |
|---|---|---|
separator | string | RegExp | A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. |
limit? | number | A value used to limit the number of elements returned in the array. |
Returns
string[]
Call Signature
ts
(splitter, limit?): string[];Split a string into substrings using the specified separator and return them as an array.
Parameters
| Parameter | Type | Description |
|---|---|---|
splitter | { [split]: string[]; } | An object that can split a string. |
splitter.[split] | - | |
limit? | number | A value used to limit the number of elements returned in the array. |
Returns
string[]
splitAmp
ts
const splitAmp: TSplitter;Defined in: src/split/splitAmp.ts:12
Splits string by ampersand.
Param
The string to split.
Returns
The split strings.
Example
ts
splitAmp('a&b&c') // => ['a', 'b', 'c']
splitAmp('hello') // => ['hello']splitDot
ts
const splitDot: TSplitter;Defined in: src/split/splitDot.ts:12
Splits string by dot.
Param
The string to split.
Returns
The split strings.
Example
ts
splitDot('a.b.c') // => ['a', 'b', 'c']
splitDot('hello') // => ['hello']splitSpace
ts
const splitSpace: TSplitter;Defined in: src/split/splitSpace.ts:12
Splits string by whitespace.
Param
The string to split.
Returns
The split strings.
Example
ts
splitSpace('a b c') // => ['a', 'b', 'c']
splitSpace('hello') // => ['hello']Functions
splitProvider()
ts
function splitProvider(delimiter): TSplitter;Defined in: src/split/splitProvider.ts:17
Creates a splitter function for the given delimiter.
Parameters
| Parameter | Type | Description |
|---|---|---|
delimiter | string | RegExp | The delimiter to split the string by. |
Returns
The splitter function.
Example
ts
const splitDash = splitProvider('-');
splitDash('a-b-c'); // => ['a', 'b', 'c']