'xxx'.toLowerCase().replace(/[^\w\s]/gi, ' ').split(/\s+/);
输入: "Bob hit a ball, the hit BALL flew far after? it; was hit."
输出: ['bob', 'hit', 'a', 'ball', 'the', 'hit', 'ball', 'flew', 'far', 'after', 'it', 'was', 'hit', '']
输入: "a, a, a, a, b,b,b,c, c"
输出: ['a', 'a', 'a', 'a', 'b', 'b', 'b', 'c', 'c']
将字符串中的所有字母转为小写,将标点符号换成空格
于 2023-05-06 16:49:40 首次发布