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

ru.astrainteractive.astralibs.util.StringListExt.kt Maven / Gradle / Ivy

There is a newer version: 3.14.1
Show newest version
package ru.astrainteractive.astralibs.util

object StringListExt {
    /**
     * If you have list with entries {"entry","ementry","emementry"} and entry="me",
     * you'll have returned list {"ementry","emementry"}.
     *
     * Very useful for TabCompleter
     *
     */
    fun List.withEntry(entry: String?, ignoreCase: Boolean = true): List {
        if (entry == null) return this
        return filter { item -> item.contains(other = entry, ignoreCase = ignoreCase) }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy