18034727885
2026-09-04 0635d28fe9c8cfe59eda6b077abf9abf665147e0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package com.igo.user.extension
 
//扩展函数 如果字符是null或者空字符串则返回block函数值
fun String?.extIsEmptyOrNull(block: () -> String): String {
    return if (isNullOrEmpty()) block.invoke() else this
}
 
//扩展函数 清除无效0
fun String.extClearInvalidZero(): String {
    if (endsWith(".000")) {
        return replace(".000", "")
    }
    if (endsWith(".00")) {
        return replace(".00", "")
    }
    if (endsWith(".0")) {
        return replace(".0", "")
    }
    return this
}