Cleanup removeArticals extension function

This commit is contained in:
Jobobby04 2021-01-25 21:33:49 -05:00
parent 0b7f8da84e
commit a088e1ffc2

View File

@ -4,8 +4,10 @@ fun List<String>.trimAll() = map { it.trim() }
fun List<String>.dropBlank() = filter { it.isNotBlank() }
fun List<String>.dropEmpty() = filter { it.isNotEmpty() }
private val articleRegex by lazy { "^(an|a|the) ".toRegex(RegexOption.IGNORE_CASE) }
fun String.removeArticles(): String {
return this.replace(Regex("^(an|a|the) ", RegexOption.IGNORE_CASE), "")
return this.replace(articleRegex, "")
}
fun String.trimOrNull(): String? {