strsplit
strsplit(x, split=' +')Splits text according to a regular expression into a list
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| x | Union[str, List[str]] | A str or a list of str | required |
| split | str | A regular expression to split x by | ' +' |
Returns
| Name | Type | Description |
|---|---|---|
| Union[List[str], List[List[str]]] | in case x is a str, a List[str], in case x is List[str]: a list of List[str] |
Examples
>>> from rlike import *
>>> strsplit('Hello World', split = " ")
['Hello', 'World']
>>> strsplit(['Hello World', 'How are you?'], split = " ")
[['Hello', 'World'], ['How', 'are', 'you?']]