How do I get up to the first n characters of a string in Java without doing a size check first (inline is acceptable) or risking an IndexOutOfBoundsExcept
n
IndexOutOfBoundsExcept
Kotlin: (If anyone needs)
var mText = text.substring(0, text.length.coerceAtMost(20))