What would be the best way to deal with the `-1` c...
# announcements
f
What would be the best way to deal with the
-1
crap that
indexOf
throws if it does not find something in a string. I find this ugly and unidiomatic for kotlin
Copy code
var doubleslash = url.indexOf("//")
if (doubleslash == -1) doubleslash = 0 else doubleslash += 2
Would like it to be similar to (I know this dont work):
Copy code
val doubleslash = (url.indexOf("//") + 2) ?: 0