static int shorten_default = 100; sS shorten(CharSequence s) { ret shorten(s, shorten_default); } sS shorten(CharSequence s, int max) { ret shorten(s, max, "..."); } sS shorten(CharSequence s, int max, S shortener) { if (s == null) ret ""; if (max < 0) ret str(s); return s.length() <= max ? str(s) : subCharSequence(s, 0, min(s.length(), max-l(shortener))) + shortener; } sS shorten(int max, CharSequence s) { ret shorten(s, max); }