Is there a better way

This is a minor Kotlin question, but I was wondering if there was a way to do this better:

var idx = someString.indexOf(‘n’)

if (idx == -1)

idx =someString.length

So basically if a string doesn’t have a line feed I want to just take the whole string into account.

excuse the formatting, I can’t get it right…

submitted by /u/arintejr
[link] [comments]