@shencom/utils-string
v1.2.0
Published
字符串相关工具方法
Downloads
10
Readme
@shencom/utils-string
字符串相关工具方法
Install
pnpm add @shencom/utils
# or
pnpm add @shencom/utils-string
Basic Usage
import { StringToArray } from '@shencom/utils';
// import { StringToArray } from '@shencom/utils-string';
Methods
StringToArray
- 说明: 字符串转数组
- 类型:
(data?: string[] | string, separator?: string): string[]
- 参数:
data
- 需要转换的字符串separator
- 分隔符
- 示例:
StringToArray(''); // [] StringToArray(undefined); // [] StringToArray('aa,bb'); // ['aa', 'bb'] StringToArray('aa|bb', '|'); // ['aa', 'bb'] StringToArray(['1', '2', '3']); // ['1', '2', '3']