Is there a method in Java to automatically ellipsize a string? Just in Java, not other libraries.
Thanks.
A oneliner which of course does not outperform the other offered solutions:
longString.replaceFirst("(.{5}).+(.{5})", "$1...$2")
Will leave only first and last 5 characters and put ... in the middle.