truncateTo

fun String.truncateTo(limit: Int, ellipsis: String = "…"): String

If the receiver is more than limit characters, truncate it and append the ellipsis, ensuring the resulting string does not exceed the limit. The limit must be at least the length of the ellipsis.