public class MoreTextUtility extends Object
Modifier and Type | Method and Description |
---|---|
static String |
toMore(String aText,
int aLength,
String aMore,
MoreTextMode aMoreTextMode)
the text is "mored" depending on the provided
MoreTextMode . |
static String |
toMoreCenter(String aText,
int aLength,
String aMore)
Truncates a text by cutting the text from left to the right and from
right to left one by one to reach the given length.
|
static String |
toMoreLeft(String aText,
int aLength,
String aMore)
Truncates a text by cutting the text from left to the right to reach the
given length.
|
static String |
toMoreRight(String aText,
int aLength,
String aMore)
Truncates a text by cutting the text from left to the right to reach the
given length.
|
public static String toMore(String aText, int aLength, String aMore, MoreTextMode aMoreTextMode)
MoreTextMode
.
In case it is MoreTextMode.NONE
, then the text is returned
untouched. In case it is MoreTextMode.LEFT
, then the text is
"mored" by the toMoreLeft(String, int, String)
method. In case
it is MoreTextMode.RIGHT
, then the text is "mored" by the
toMoreRight(String, int, String)
method.aText
- The text to be truncated.aLength
- The length to be reached.aMore
- The text to be prepended to the left in case the text was
longer than the required length.aMoreTextMode
- The MoreTextMode
specifying on how to
truncate the text.public static String toMoreLeft(String aText, int aLength, String aMore)
aText
- The text to be truncated.aLength
- The length to be reached.aMore
- The text to be prepended to the left in case the text was
longer than the required length.String
, when being longer than the provided length,
which is being truncated and prepended with the given more (e.g.
"...") text, altogether being of the required length.public static String toMoreRight(String aText, int aLength, String aMore)
aText
- The text to be truncated.aLength
- The length to be reached.aMore
- The text to be prepended to the left in case the text was
longer than the required length.String
, when being longer than the provided length,
which is being truncated and prepended with the given more (e.g.
"...") text, altogether being of the required length.public static String toMoreCenter(String aText, int aLength, String aMore)
aText
- The text to be truncated.aLength
- The length to be reached.aMore
- The text to be prepended to the left in case the text was
longer than the required length.String
, when being longer than the provided length,
which is being truncated and prepended with the given more (e.g.
"...") text, altogether being of the required length.Copyright © 2015. All rights reserved.