```typescript import stringUtil from "codestar-string-util"; ```
npm install codestar-string-utiltypescript
import stringUtil from "codestar-string-util";
`
字符串转数组
`
stringUtil.textToArray(text: string, separator = "\n", trimBlank = true): string[]
example:
expect(stringUtil.textToArray(
)).toStrictEqual(['1', '2'])
`
驼峰转下划线
`
expect(stringUtil.camelToUnderline('userName')).toBe('user_name')
expect(stringUtil.camelToUnderline('UserName')).toBe('user_name')
`
下划线转驼峰
`
expect(stringUtil.underlineToCamel('user_name')).toBe('userName')
`
去掉字符串中的utf8-bom
`
stringUtil.stripBom(string: string): string
``