Package dev.schlaubi.stdx.core

Functions

Link copied to clipboard
inline fun <K, E> MutableMap<K, E>.computeIfAbsent(key: K, initializer: () -> E): E

Retrieves the element corresponding to key from this map if it already exists or creates it by calling initializer and saving the result to the map

Link copied to clipboard
inline fun String?.isNotNullOrBlank(): Boolean

Returns false if this nullable char sequence is either null or empty or consists solely of whitespace characters.

Link copied to clipboard
inline fun String?.isNotNullOrEmpty(): Boolean

Returns false if this nullable char sequence is either null or empty.

Link copied to clipboard
inline fun String.isNotNumeric(): Boolean

Checks whether a String is not numeric (meaning it contains an Integer)

Link copied to clipboard
fun String.isNumeric(): Boolean

Checks whether a String is numeric (meaning it contains an Integer)

Link copied to clipboard
fun String.limit(maxLength: Int, truncate: String = "..."): String

Limits this string to maxLength and adds truncate at the end if the string was shortened-

Link copied to clipboard
fun String.nullIfBlank(): String?

Returns null if this String isBlank or the String itself

Link copied to clipboard
inline fun <T> Iterable<T>.onEach(action: T.() -> Unit)

Performs the given action on each element.

Link copied to clipboard
fun List<String>.paginate(pageLength: Int, separator: String = ""): List<String>

Tries to paginate this Strings (seperated by separator) into pages of pageLength with words in mind.

Link copied to clipboard
fun String.splitList(): List<String>

Splits a comma seperated list.

Link copied to clipboard
fun String.splitListStrict(): List<String>

Splits a comma seperated list.