CharSequence (@NotNull CharSequence text, int length, boolean appendEllipsis) { if (text.length() <= length) { return text; } if (appendEllipsis) { return text.subSequence(0, length) + "..."; } return text.subSequence(0, length); }