Hi! Do you have an alternative for `substringAfter...
# announcements
l
Hi! Do you have an alternative for
substringAfter("X")
where X is a regex? so
substringAfter(regex)
t
I don't think there is one built-in, but you can easily write your own :
Copy code
fun String.substringAfter(pattern: Regex, missingPatternValue: String = this): String {
    val result = pattern.find(this) ?: return missingPatternValue
    return substring(result.range.endInclusive + 1, length)
}