Package com.day.text
Class StringAbbreviator
- java.lang.Object
-
- com.day.text.StringAbbreviator
-
public class StringAbbreviator extends java.lang.Object
String abbreviator that uses a macosx-style ellipsis algorithm, where an ellipsis is added in the middle of a string instead of at the end.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_ELLIPSIS
static java.lang.String
SPACE
-
Constructor Summary
Constructors Constructor Description StringAbbreviator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
abbreviate(java.lang.String str, int maxLength)
Abbreviate str if needed, so that its number of characters is <= maxCharsjava.lang.String
getEllipsis()
void
setEllipsis(java.lang.String s)
Set our ellipsis string, to the default if s is null
-
-
-
Field Detail
-
SPACE
public static final java.lang.String SPACE
- See Also:
- Constant Field Values
-
DEFAULT_ELLIPSIS
public static final java.lang.String DEFAULT_ELLIPSIS
- See Also:
- Constant Field Values
-
-
Method Detail
-
abbreviate
public java.lang.String abbreviate(java.lang.String str, int maxLength)
Abbreviate str if needed, so that its number of characters is <= maxChars
-
setEllipsis
public void setEllipsis(java.lang.String s)
Set our ellipsis string, to the default if s is null
-
getEllipsis
public java.lang.String getEllipsis()
-
-