splitBy()
splitBy(
str
?:string
,splitChar
?:string
):string
[]
Splits a string by a given character (see defaultJoinChar). Escaped characters (characters preceded by a backslash) will not apply to the split, and the backslash will be removed in the array element. Inverse of joinWith.
Parameters
Parameter | Type | Default value |
---|---|---|
str ? | string | undefined |
splitChar ? | string | defaultJoinChar |
Returns
string
[]
Example
splitBy('this\\,\\,that,,the other,,,\\,')
// or
splitBy('this\\,\\,that,,the other,,,\\,', ',')
// would return
['this,,that', '', 'the other', '', '', ',']
Defined in
packages/react-querybuilder/src/utils/arrayUtils.ts:15
caution
API documentation is generated from the latest commit on the main
branch. It may be somewhat inconsistent with official releases of React Query Builder.