input box trans

This commit is contained in:
Gabe Yuan
2023-09-14 10:59:50 +08:00
parent 14ca13e31d
commit 76f54461e7
6 changed files with 42 additions and 8 deletions

View File

@@ -179,3 +179,18 @@ export const isSameSet = (a, b) => {
const s = new Set([...a, ...b]);
return s.size === a.size && s.size === b.size;
};
/**
* 去掉字符串末尾某个字符
* @param {*} s
* @param {*} c
* @param {*} count
* @returns
*/
export const removeEndchar = (s, c, count = 1) => {
let i = s.length;
while (i > s.length - count && s[i - 1] === c) {
i--;
}
return s.slice(0, i);
};