You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
339 B
15 lines
339 B
7 months ago
|
export function trim(str: string): string {
|
||
|
const regex = /[\u200b\uFEFF\u2060]/g
|
||
|
return str.replace(regex, '')
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 获取给定值的小数位数
|
||
|
* @param num
|
||
|
* @returns
|
||
|
*/
|
||
|
export function getDecimalLength(num: number | string): number {
|
||
|
const match = num.toString().match(/\.(\d+)/)
|
||
|
return match ? match[1].length : 0
|
||
|
}
|