All Downloads are FREE. Search and download functionalities are using the official Maven repository.

invirt.utils.enum.kt Maven / Gradle / Ivy

package invirt.utils

inline fun > valueOfOrNull(name: String): E? {
    return enumValues().firstOrNull { it.name == name }
}

/**
 * Parses a comma separated string of enum names into a list of enum values
 */
inline fun > String?.toEnumValues(): List {
    if (this.isNullOrBlank()) {
        return emptyList()
    }
    return this.split(",")
        .map { it.trim() }
        .map { enumValueOf(it) }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy