Package adams.core
Class Shortening
- java.lang.Object
-
- adams.core.Shortening
-
public class Shortening extends Object
Helper class for shortening operations.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description Shortening()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
shorten(String s, int max, ShorteningType type)
Shortens a string if longer than the maximum.static String
shortenEnd(String s, int max)
Shortens a string (and appends "...") if longer than the allowed maximum number of characters.static String
shortenMiddle(String s, int max)
Shortens the string in the middle (inserting "..") if longer than specified number of characters.static String
shortenStart(String s, int max)
Shortens the string in the middle (inserting "..") if longer than specified number of characters.
-
-
-
Method Detail
-
shortenStart
public static String shortenStart(String s, int max)
Shortens the string in the middle (inserting "..") if longer than specified number of characters.- Parameters:
s
- the string to (potentially) shortenmax
- the maximum number of chars- Returns:
- the processed string
-
shortenMiddle
public static String shortenMiddle(String s, int max)
Shortens the string in the middle (inserting "..") if longer than specified number of characters.- Parameters:
s
- the string to (potentially) shortenmax
- the maximum number of chars- Returns:
- the processed string
-
shortenEnd
public static String shortenEnd(String s, int max)
Shortens a string (and appends "...") if longer than the allowed maximum number of characters.- Parameters:
s
- the string to processmax
- the maximum number of characters.- Returns:
- the processed string
-
shorten
public static String shorten(String s, int max, ShorteningType type)
Shortens a string if longer than the maximum.- Parameters:
s
- the string to processmax
- the maximum number of characterstype
- the type of shortening- Returns:
- the processed string
-
-