Updated on 2026-08-14

This commit is contained in:
Tangem 2023-10-10 15:40:23 +03:00
parent 36fabffe3a
commit c8da4e40e1
3 changed files with 10 additions and 3 deletions

View file

@ -1,9 +1,15 @@
package com.tangem.utils
import java.math.BigDecimal
inline fun <reified T : Enum<T>> safeValueOf(type: String, default: T): T {
return try {
java.lang.Enum.valueOf(T::class.java, type)
} catch (e: IllegalArgumentException) {
default
}
}
fun BigDecimal?.isNullOrZero(): Boolean {
return this == null || this.compareTo(BigDecimal.ZERO) == 0
}