💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## words + [link](./words "Link to this entry.") + [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L13063 "View in source.") + [npm](https://www.npmjs.com/package/lodash.words "See the npm package.") ``` _.words([string=''], [pattern]) ``` 拆分字符串中的词为数组 ### 参数 1. [string=''] (string) 要处理的字符串 2. [pattern] (RegExp|string) 匹配模式 ### 返回值 (Array) 然后拆分后的数组 ### 示例 ``` _.words('fred, barney, & pebbles'); // => ['fred', 'barney', 'pebbles'] _.words('fred, barney, & pebbles', /[^, ]+/g); // => ['fred', 'barney', '&', 'pebbles'] ```