This commit is contained in:
jl-zhoujl2
2022-05-24 13:06:41 +08:00
parent 54335a40ac
commit ba2777bfd7
17 changed files with 661 additions and 623 deletions

View File

@ -307,8 +307,11 @@ export const numberToChinese = (num: any) => {
* @param str
* @returns
*/
export const trim = (str: string | undefined) => {
let _str = str?.replace(/(^\s*)|(\s*$)/g, "");
_str = _str?.replace(/[<>|\\/?:*""“”\s\r\n\t]/, "");
return _str;
export const trim = (str: string): string => {
if (isNotEmpty(str)) {
let _str = str.replace(/(^\s*)|(\s*$)/g, "");
_str = _str.replace(/[<>|\\/?:*""“”\s\r\n\t]/, "");
return _str;
}
return '';
}