Gabe Kauffman
05/28/2020, 11:06 PMString
?
Example, putting a function like this globally scoped in like a StringUtils.kt
class:
fun String.getLinkIfPresent(): String? {
val m: Matcher = urlPattern.matcher(this)
if (m.find()) {
return m.group().trim()
}
return null
}
Casey Brooks
05/28/2020, 11:15 PMString
. Being one of the most-used and most-flexible classes, it makes sense to wrap common String use-cases into an extension.
Extensions on number or boolean types feels a bit more dirty to meCasey Brooks
05/28/2020, 11:16 PMJakub
05/28/2020, 11:19 PMurlPattern
. This may lead to Singletons which are bad practice.Gabe Kauffman
05/29/2020, 12:12 AM