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