Using Apache commons to truncate a string

Truncate a string and add ellipsis as necessary.

import org.apache.commons.lang.StringUtils;

StringUtils.abbreviate(str, maxLength);

0 comments: