maxLength

Truncates this String to at most len characters.

A surrogate pair (such as an emoji) that would be cut in half is dropped whole, so the result can be one character shorter than len.

Return

the original string if its length is within len, otherwise its first len characters

Parameters

len

the maximum length

Throws