public final class Util extends Object
Modifier and Type | Method and Description |
---|---|
protected static String |
combine(String... args)
Combines an unknown number of Strings to one String.
|
static boolean |
containsNewlines(String toExamine)
Tells us whether the string contains newlines.
|
static String[][] |
createMatrix(String[] data)
Creates a matrix according to the number of new lines given into the
method.
|
protected static String |
implode(String glue,
String[] what)
Concantenate a String array "what" with glue "glue".
|
protected static String |
pad(String data,
char doPadWithThis,
int totalWidth,
AbstractTabularComponent.Alignment orientation)
This method fills one char either on the right site of a given string or
on the left site or on both sites.
|
protected static String |
repeat(String toBeRepeated,
int numTimes)
a str_repeat function.
|
protected static String combine(String... args)
args
- multiple Stringsprotected static String pad(String data, char doPadWithThis, int totalWidth, AbstractTabularComponent.Alignment orientation)
pad ("hello",'-',11,NiceTable.LEFT); results in "hello------" pad("hello",'/',11,NiceTable.RIGHT); results in "//////hello"; pad("hello",'.',11,NiceTable.CENTER); results in "...hello..."
doPadWithThis
- the string to pad the string withdata
- the data to padorientation
- which orientation to taketotalWidth
- the total width of the result stringprotected static String implode(String glue, String[] what)
what
- the array of strings to concantenateglue
- the glue string to use.
String[] what = { "a", "b", "c" }; String s = Util.implode("-", what); // result is "a-b-c"
protected static String repeat(String toBeRepeated, int numTimes)
toBeRepeated
- the string to repeatnumTimes
- how many times to concantenate the stringpublic static boolean containsNewlines(String toExamine)
toExamine
- to be checkedCopyright © 2013 University of Konstanz, Distributed Systems Group. All Rights Reserved.