35 lines
678 B
Java
35 lines
678 B
Java
package org.gcube.portlets.widgets.ckancontentmoderator.client.ui.util;
|
|
|
|
|
|
/**
|
|
* The Class UtilFunct.
|
|
*
|
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
*
|
|
* Jun 22, 2021
|
|
*/
|
|
public class UtilFunct {
|
|
|
|
/**
|
|
* Ellipsis.
|
|
*
|
|
* @param value the value
|
|
* @param lenght the length
|
|
* @param left the left
|
|
* @return the string
|
|
*/
|
|
public static String ellipsis(String value, int length, boolean left) {
|
|
if (value.length() < 3)
|
|
return value;
|
|
|
|
if (value.length() > length) {
|
|
if (left)
|
|
return "..." + value.substring(value.length() - length + 3);
|
|
else
|
|
return value.substring(0, length) + "...";
|
|
}
|
|
return value;
|
|
}
|
|
|
|
}
|