37 lines
No EOL
1.1 KiB
TypeScript
37 lines
No EOL
1.1 KiB
TypeScript
//#region src/compat/string/split.d.ts
|
|
/**
|
|
* Splits the input string by the specified `separator`
|
|
* and returns a new array containing the split segments.
|
|
*
|
|
* @param [string=''] The string to split.
|
|
* @param [separator] The separator pattern to split by.
|
|
* @param [limit] The length to truncate results to.
|
|
* @returns Returns the string segments.
|
|
*
|
|
* @example
|
|
* split('a-b-c', '-');
|
|
* // => ['a', 'b', 'c']
|
|
*
|
|
* split('a-b-c', '-', 2);
|
|
* // => ['a', 'b']
|
|
*/
|
|
declare function split(string: string | null | undefined, separator?: RegExp | string, limit?: number): string[];
|
|
/**
|
|
* Splits the input string by the specified `separator`
|
|
* and returns a new array containing the split segments.
|
|
*
|
|
* @param [string=''] The string to split.
|
|
* @param [separator] The separator pattern to split by.
|
|
* @param [limit] The length to truncate results to.
|
|
* @returns Returns the string segments.
|
|
*
|
|
* @example
|
|
* split('a-b-c', '-');
|
|
* // => ['a', 'b', 'c']
|
|
*
|
|
* split('a-b-c', '-', 2);
|
|
* // => ['a', 'b']
|
|
*/
|
|
declare function split(string: string | null | undefined, index: string | number, guard: object): string[];
|
|
//#endregion
|
|
export { split }; |