public class TextLib
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
convertToCSVValue(java.lang.String value,
java.lang.String valueSeparator)
Convert a value to CSV format according to RFC 4180.
|
static java.lang.String |
convertValuesToCSVLine(java.util.ArrayList<java.lang.String> values,
java.lang.String valueSeparator,
boolean addLineTerminator)
Convert multiple values to a CVS formatted line according to RFC 4180.
|
static java.lang.String |
encloseAndEscapeValue(java.lang.String value,
java.lang.String encloseChar)
Enclose a value at the start and the end with a char and escape special value chars.
|
static boolean |
is85PercentHexText(java.lang.String s)
Get if a text contains 85% or more HEX digit chars.
|
static boolean |
isBooleanText(java.lang.String s)
Check if a text is a boolean value ('true' or ''false - case insensitive).
|
static boolean |
isHexText(java.lang.String s)
Check if a text is a HEX value (case insensitive).
|
static boolean |
isNumberText(java.lang.String s)
Check if a text is a number.
|
public static boolean isBooleanText(java.lang.String s)
s - the text to checkpublic static boolean isNumberText(java.lang.String s)
s - the text to checkpublic static boolean isHexText(java.lang.String s)
s - the text to checkpublic static boolean is85PercentHexText(java.lang.String s)
s - the text to check, note that only the first 30 chars are checkedpublic static java.lang.String encloseAndEscapeValue(java.lang.String value,
java.lang.String encloseChar)
value - the value to enclose and escapeencloseChar - the enclose char (typically a quote or a double quote)public static java.lang.String convertToCSVValue(java.lang.String value,
java.lang.String valueSeparator)
value - the value to convertvalueSeparator - the separator (delimiter) between the values (for example ',' or ';')public static java.lang.String convertValuesToCSVLine(java.util.ArrayList<java.lang.String> values,
java.lang.String valueSeparator,
boolean addLineTerminator)
values - the values to convertvalueSeparator - the separator (delimiter) between the values (for example ',' or ';')addLineTerminator - if true add a line terminator at end of the line