diff options
Diffstat (limited to 'src/util/String.ts')
-rw-r--r-- | src/util/String.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/util/String.ts b/src/util/String.ts new file mode 100644 index 00000000..afbfc1e6 --- /dev/null +++ b/src/util/String.ts @@ -0,0 +1,6 @@ +export const DOUBLE_WHITE_SPACE = /\s\s+/g; +export const SPECIAL_CHAR = /[@#`:\r\n\t\f\v\p{C}]/gu; + +export function trimSpecial(str: string) { + return str.replace(SPECIAL_CHAR, "").replace(DOUBLE_WHITE_SPACE, " ").trim(); +} |