Skip to content
大纲

字符串去重 ​

语法 ​

js
import { removeStrDuplicates } from 'warbler-js';
const result = removeStrDuplicates(str);

参数 ​

  • str (String) : 需要去重的字符串。

返回值 ​

String : 去重后的字符串。

源码 ​

js
const removeStrDuplicates = (str) => [...new Set(str)].join('');

例子 ​

js
import { removeStrDuplicates } from 'warbler-js';
const initStr = 'aaa bbb ccc  dd  ee aab aac';
const finallyStr = removeStrDuplicates(initStr);
console.log(finallyStr); //=> a bcde

添加版本 ​

1.2.2

Released under the MIT License.