/** * */ package org.gcube.portlets.user.geoportaldataviewer.client.util; /** * The Class StringUtil. * * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) * * Nov 16, 2020 */ public class StringUtil { /** * Ellipsize. * * @param input the input string that may be subjected to shortening * @param maxCharacters the maximum characters that must be returned for the input string * @return the string * @throws Exception the exception */ public static String ellipsize(String input, int maxCharacters) { if (input == null || input.length() < maxCharacters) { return input; } return input.substring(0, maxCharacters)+"..."; } }