lastIndex

val CharSequence.lastIndex: Int

Returns the index of the last character in the char sequence or -1 if it is empty.