dimsuz
04/18/2018, 2:31 PMone two three
-> one two\nthree
.
There's replaceFirst
, but no replaceLast
diesieben07
04/18/2018, 2:40 PMval idx = string.lastIndexOf(' ')
val replaced = if (idx < 0) string else string.replaceRange(idx, idx+1, "\n")
Although there should be a replaceLast
for sure. Not sure why there isn't.dimsuz
04/18/2018, 2:40 PMhho
04/19/2018, 10:22 AM