Is there a function in kotlin like trimIndent or t...
# android
a
Is there a function in kotlin like trimIndent or trimMargin to replace all whitespaces and all line breaks from a string template with a single space? If not, how can one achieve this? With regex?
k
You could use
.replace
a
Yeah I could, but I was hoping there would be some trim method for this. Or reindent method.
j
str.replace("\\s".toRegex(), " ")