Modifier and Type | Class and Description |
---|---|
static class |
CharLayout.HA
Possible horizontal alignments.
|
Modifier and Type | Method and Description |
---|---|
static List<String> |
align(List<String> text,
CharLayout.HA ha)
Align lines.
|
static void |
append(List<StringBuilder> rows,
StringBuilder target)
Append rows to a
StringBuilder target. |
static ArrayList<StringBuilder> |
builder()
Construct an empty builder.
|
static ArrayList<StringBuilder> |
builder(String multilineString)
Construct an empty builder initialized from a multiline.
|
static String |
builderToString(List<StringBuilder> rows)
Collapse builder contents to a String.
|
static List<String> |
join(CharLayout.HA ha,
String sep,
List<String>... cols)
Join an arbitrary set of multiliners.
|
static List<String> |
join(List<String> col1,
CharLayout.HA ha1,
String sep,
List<String> col2,
CharLayout.HA ha2)
Join two set of multiliners.
|
static void |
joinTo(ArrayList<StringBuilder> builder,
List<String> column,
CharLayout.HA ha,
String separator)
Join a new new column to previous column(s) represented as mutable rows.
|
static void |
joinTo(ArrayList<StringBuilder> builder,
String separator)
Join the same line to each row.
|
static void |
joinTo(ArrayList<StringBuilder> builder,
String[] column,
CharLayout.HA ha,
String separator)
Join a new new column to previous column(s) represented as mutable rows.
|
static String[] |
makeColumn(String header,
int rowCount,
CharLayout.HA ha,
IntFunction<String> row)
Create a column.
|
static String |
mul(char c,
int l) |
static String |
pad(String s,
int l,
CharLayout.HA ha)
Align
String to the given length. |
static List<String> |
prefix(String prefix,
List<String> text)
Prefix lines.
|
static String |
prefixMultiline(String prefix,
String multilineString)
Prefix multi line String.
|
static List<String> |
split(String s)
Split to lines.
|
static String |
toString(List<String> s)
Collapse into a multiline
String . |
static String |
toString(String[] s)
Collapse into a multiline
String . |
public static List<String> split(String s)
s
- A possibly multiline Stringpublic static String prefixMultiline(String prefix, String multilineString)
prefix
- Prefix to attachmultilineString
- Multi line Stringpublic static ArrayList<StringBuilder> builder()
public static ArrayList<StringBuilder> builder(String multilineString)
multilineString
- Multi line Stringpublic static String builderToString(List<StringBuilder> rows)
rows
- Rowspublic static void append(List<StringBuilder> rows, StringBuilder target)
StringBuilder
target.rows
- Rowstarget
- Target to append each rowpublic static String toString(List<String> s)
String
.s
- Linespublic static String toString(String[] s)
String
.s
- Linespublic static void joinTo(ArrayList<StringBuilder> builder, List<String> column, CharLayout.HA ha, String separator)
builder
- Previous columns. Length will be equalized. New rows will be added on demand.column
- Column to joinha
- Horizontal alignment of the new columnseparator
- Separator between columnspublic static void joinTo(ArrayList<StringBuilder> builder, String[] column, CharLayout.HA ha, String separator)
builder
- Previous columns. Length will be equalized. New rows will be added on demand.column
- Column to joinha
- Horizontal alignment of the new columnseparator
- Separator between columnspublic static void joinTo(ArrayList<StringBuilder> builder, String separator)
builder
- Previous column; length will be equalizedseparator
- Separator to add to each rowpublic static String[] makeColumn(String header, int rowCount, CharLayout.HA ha, IntFunction<String> row)
header
- Header row content, aligned to centerrowCount
- Row countha
- Horizontal alignment of further rowsrow
- Function to create row from 0-based row indexpublic static String mul(char c, int l)
public static String pad(String s, int l, CharLayout.HA ha)
String
to the given length.s
- A one line String. Note that the presence of '\n' characters are not checked.l
- Character count to pad toha
- AlignmentIllegalArgumentException
- when the string is longer than the specified padded lengthpublic static List<String> align(List<String> text, CharLayout.HA ha)
This method applies #pad(java.lang.String, int, com.chemaxon.descriptors.CharLayout.HA)
to all lines,
setting length to the length of the longest line.
text
- Linesha
- Desired alignemntpublic static List<String> prefix(String prefix, List<String> text)
prefix
- Prefix to usetext
- Linespublic static List<String> join(CharLayout.HA ha, String sep, List<String>... cols)
ha
- Horizontal alignment for all of the columnssep
- Sparation between all columnscols
- Columnspublic static List<String> join(List<String> col1, CharLayout.HA ha1, String sep, List<String> col2, CharLayout.HA ha2)
col1
- First columnha1
- Alignemnt of first columnsep
- Separator between columnscol2
- Second columnha2
- Alignment of the second column