public class StringTools
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
getKeyValue(java.lang.String key,
java.util.ArrayList<java.lang.String> values)
Will maybe be moved to StringTools.
|
static java.lang.String |
getKeyValue(java.lang.String key,
java.lang.String value)
Will maybe be moved to StringTools.
|
static java.lang.String |
getKeyValue(java.lang.String key,
java.lang.String value,
boolean escapeValue)
Will maybe be moved to StringTools.
|
static java.lang.String |
getStringEcp(java.lang.String txt)
Will maybe be moved to StringTools.
|
static java.lang.String |
join(java.util.ArrayList<java.lang.String> list,
java.lang.String separator)
Joins a list of elements to one single String.
|
static java.lang.String |
join(float[] list,
java.lang.String separator)
Joins a list of elements to one single String.
|
static java.lang.String |
join(int[] list,
java.lang.String separator)
Joins a list of elements to one single String.
|
static java.lang.String |
join(java.lang.Object[] list,
java.lang.String separator)
Joins a list of elements to one single String.
|
static java.lang.String |
join(java.lang.String separator,
java.lang.Object... elements)
Joins a list of elements to one single String.
|
static java.lang.String |
joinAndFormat(float[] list,
java.lang.String separator,
int d1,
int d2)
Joins a list of elements to one single String.
|
static java.lang.String |
joinAndFormat(int[] list,
java.lang.String separator,
int digits)
Joins a list of elements to one single String.
|
static java.lang.String |
nf(int val,
int digits)
Parses the given int to a String.
|
static java.lang.String |
nfs(float val,
int d1,
int d2)
Parses the given value to a String.
|
static java.lang.String |
timestamp()
Returns a String containing the current time (yyyymmdd_hhmmss).
|
public static java.lang.String timestamp()
public static java.lang.String nf(int val,
int digits)
StringTools.nf(3, 4); // "+0003" StringTools.nf(-1999, 3); // "-999"
val - The number that should be parsed.digits - The number of numbers that should be in the output String.public static java.lang.String nfs(float val,
int d1,
int d2)
StringTools.nfs(3.5, 2, 2); // "+03.50" StringTools.nfs(-1999, 3, 2); // "-999.00"
val - The number that should be parsed.d1 - The number of numbers before the point.d2 - The number of numbers after the point.public static java.lang.String join(float[] list,
java.lang.String separator)
list - A float array which should be joined.separator - A String which will be used to separate the elements of the
input list.public static java.lang.String join(int[] list,
java.lang.String separator)
list - A float array which should be joined.separator - A String which will be used to separate the elements of the
input list.public static java.lang.String join(java.lang.String separator,
java.lang.Object... elements)
separator - A String which will be used to separate the elements of the
input list.elements - One or more elements that should be joined.public static java.lang.String join(java.lang.Object[] list,
java.lang.String separator)
list - A float array which should be joined.separator - A String which will be used to separate the elements of the
input list.public static java.lang.String join(java.util.ArrayList<java.lang.String> list,
java.lang.String separator)
list - A float array which should be joined.separator - A String which will be used to separate the elements of the
input list.public static java.lang.String joinAndFormat(float[] list,
java.lang.String separator,
int d1,
int d2)
float[] vals = { 3.4, -267.45, -23.246 };
StringTools.joinAndFormat(vals, ",", 2, 2); // "+03.40,-67.45,-23.24"
list - A float array which should be joined.separator - A String which will be used to separate the elements of the
input list.d1 - The number of numbers before the point.d2 - The number of numbers after the point.public static java.lang.String joinAndFormat(int[] list,
java.lang.String separator,
int digits)
int[] vals = { 3, 1999, -23 };
StringTools.joinAndFormat(vals, ",", 3); // "+003,+999,-023"
list - A float array which should be joined.separator - A String which will be used to separate the elements of the
input list.digits - The number of numbers for each list element.public static java.lang.String getStringEcp(java.lang.String txt)
txt - The input text.public static java.lang.String getKeyValue(java.lang.String key,
java.util.ArrayList<java.lang.String> values)
key - The key of the key-value pair.values - A list of String values.public static java.lang.String getKeyValue(java.lang.String key,
java.lang.String value,
boolean escapeValue)
key - The key of the key-value pair.value - The value of the key-value pair.escapeValue - Defines if the value part should be escaped. Should be false,
if the value is already escaped or the value is a pre-formated
array-string.public static java.lang.String getKeyValue(java.lang.String key,
java.lang.String value)
key - The key of the key-value pair.value - The value of the key-value pair.