public class TextBlockUtility extends Object
Modifier and Type | Method and Description |
---|---|
static String |
fromTextBlock(String[] aTextBlock)
|
static String |
fromTextBlock(String[] aTextBlock,
String aDelimeter)
|
static String[][] |
toColumns(String[][] aColumns,
TextBlockMode aTextBlockMode)
Creates an array of
String arrays where all the arrays are of the
same length and where the arrays are all aligned as specified by the
passed TextBlockMode |
static String |
toNonBreakingLine(String aText)
Creates a single line by replacing all new lines, line feeds and
tabulators from the given
String by full stops or spaces
(heuristic) so that it is displayed in one single line. |
static String[] |
toTextBlock(String[] aTextBlock,
int aHeight,
TextBlockMode aTextBlockMode)
Fills up or truncates a given text block to the provided height; filling
up or truncating depends on the
TextBlockMode specified, the
default is TextBlockMode.TOP . |
static String[] |
toTextBlock(String aText,
int aLength)
|
static String[] |
toTextBlock(String aText,
int aLength,
LineSplitMode aLineSplitMode)
|
static String[] |
toTextBlock(String aText,
int aLength,
TextAlignMode aTextAlignMode)
|
static String[] |
toTextBlock(String aText,
int aLength,
TextAlignMode aTextAlignMode,
LineSplitMode aLineSplitMode)
|
public static String toNonBreakingLine(String aText)
String
by full stops or spaces
(heuristic) so that it is displayed in one single line.public static String[] toTextBlock(String aText, int aLength, LineSplitMode aLineSplitMode)
String
into subString
instances with the maximum
given length. The array of the resulting String
instances is
returned.aText
- The String
text line to be cut into sub
String
instances ( String
array).aLength
- The maximum length of a line returned in the
String
array.aLineSplitMode
- Depending on which value is passed, a line is split
into subString
instances preferably reckoning an end of a
line ( LineSplitMode.AT_END_OF_LINE
), preferably reckoning
the spaces (LineSplitMode.AT_SPACE
) or exactly reckoning a
given width (LineSplitMode.AT_FIXED_WIDTH
).String
array with the subString
instances.public static String[] toTextBlock(String aText, int aLength, TextAlignMode aTextAlignMode)
String
into subString
instances with the maximum
given length. The array of the resulting String
instances is
returned.aText
- The String
text line to be cut into sub
String
instances ( String
array).aLength
- The maximum length of a line returned in the
String
array.aTextAlignMode
- The TextAlignMode
specifies on how a line
is to be aligned in the result.String
array with the subString
instances.public static String[] toTextBlock(String aText, int aLength, TextAlignMode aTextAlignMode, LineSplitMode aLineSplitMode)
String
into subString
instances with the maximum
given length. The array of the resulting String
instances is
returned.aText
- The String
text line to be cut into sub
String
instances ( String
array).aLength
- The maximum length of a line returned in the
String
array.aTextAlignMode
- The TextAlignMode
specifies on how a line
is to be aligned in the result.aLineSplitMode
- Depending on which value is passed, a line is split
into subString
instances preferably reckoning an end of a
line ( LineSplitMode.AT_END_OF_LINE
), preferably reckoning
the spaces (LineSplitMode.AT_SPACE
) or exactly reckoning a
given width (LineSplitMode.AT_FIXED_WIDTH
).String
array with the subString
instances.public static String[] toTextBlock(String[] aTextBlock, int aHeight, TextBlockMode aTextBlockMode)
TextBlockMode
specified, the
default is TextBlockMode.TOP
. When filling up a line, a
String
filled with space (" ") characters the length of the first
element in the array is used.aTextBlock
- The tect block to be filled up / truncated.aHeight
- The height of the resulting text block.aTextBlockMode
- The mode on how to fill up the text block. The mode
can be TextBlockMode.BOTTOM
, TextBlockMode.CENTER
or TextBlockMode.TOP
public static String[][] toColumns(String[][] aColumns, TextBlockMode aTextBlockMode)
String
arrays where all the arrays are of the
same length and where the arrays are all aligned as specified by the
passed TextBlockMode
aColumns
- An array of String
arrays to be equalized.aTextBlockMode
- The TextBlockMode
to be used when
equalizing the columns.Copyright © 2015. All rights reserved.