Tried to use the `replace` function `inline fun C...
# stdlib
v
Tried to use the
replace
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
?
g
I’m guessing it’s because not all matches contain groups, and destructuring a MatchResult with no groups makes no sense.