voddan
02/13/2018, 9:05 AMreplace
function
inline fun CharSequence.replace(regex: Regex, noinline transform: (MatchResult) -> CharSequence): String
And found out that I can't easily destructure the lambda parameter and have to use MatchResult.destructured
instead
http://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/-match-result/destructured.html
Why the most intuitive usage text.replace(Regex("(\\d+)(\\w+)")) { (digits, letters) -> ""}
was not supported?
What's the point of having a separate wrapper for desctructuring? http://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/-match-result/-destructured/index.html
Shouldn't we add componentN()
extension function to MatchResult
?Graham Lea
02/20/2018, 9:16 AM