18034727885
2026-08-07 237bd0e7494cb73bc351b2e6002831fa593eec4c
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
}