public class StringUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CRLF |
static String |
EMPTY_STRING |
static String |
FIELD_CLOSE |
static String |
FIELD_OPEN |
static String |
HEX_CLOSE |
static String |
HEX_OPEN |
static String |
INDENTCHARS |
static String[] |
SYSTEM_PROPERTIES |
static String |
UNIX_CLOSE |
static String |
UNIX_OPEN |
static String |
WINDOWS_CLOSE |
static String |
WINDOWS_OPEN |
Constructor and Description |
---|
StringUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
environmentSubstitute(String aString,
Map<String,String> systemProperties)
Substitutes variables in
aString with the environment values in the system properties |
static String |
generateRandomString(int length,
String prefix,
String postfix,
boolean uppercase) |
static String |
getFormattedDateTime(Date date)
Giving back a date/time string in the format following the rule from the most to the least significant
|
static String |
getFormattedDateTime(Date date,
boolean milliseconds)
Giving back a date/time string in the format following the rule from the most to the least significant
|
static String |
getFormattedDateTimeNow()
Giving back the actual time as a date/time string in the format following the rule from the most to the least
significant
|
static String |
getFormattedDateTimeNow(boolean milliseconds)
Giving back the actual time as a date/time string in the format following the rule from the most to the least
significant
|
static String |
getIndent(int indentLevel) |
static void |
getUsedVariables(String aString,
List<String> list,
boolean includeSystemVariables) |
static String |
getVariableName(String variable)
remove specification from variable
|
static String |
initCap(String st) |
static boolean |
IsDate(String str) |
static boolean |
IsDate(String str,
String mask) |
static boolean |
isEmpty(String string)
Check if the string supplied is empty.
|
static boolean |
isEmpty(StringBuffer string)
Check if the stringBuffer supplied is empty.
|
static boolean |
IsInteger(String str) |
static boolean |
IsNumber(String str) |
static boolean |
isSystemVariable(String aString) |
static Date |
str2dat(String arg0,
String arg1,
String val) |
static double |
str2num(String pattern,
String decimal,
String grouping,
String currency,
String value) |
static String |
substitute(String aString,
Map<String,String> variablesValues,
String open,
String close)
Substitutes variables in
aString . |
static String |
substitute(String aString,
Map<String,String> variablesValues,
String open,
String close,
int recursion)
Substitutes variables in
aString . |
static String |
substituteField(String aString,
RowMetaInterface rowMeta,
Object[] rowData)
Substitutes field values in
aString . |
static String |
substituteHex(String aString)
Substitutes hex values in
aString and convert them to operating system char equivalents in the return
string. |
static String |
substituteUnix(String aString,
Map<String,String> variables)
Substitutes variables in
aString . |
static String |
substituteWindows(String aString,
Map<String,String> variables)
Substitutes variables in
aString . |
public static final String UNIX_OPEN
public static final String UNIX_CLOSE
public static final String WINDOWS_OPEN
public static final String WINDOWS_CLOSE
public static final String HEX_OPEN
public static final String HEX_CLOSE
public static final String FIELD_OPEN
public static final String FIELD_CLOSE
public static final String CRLF
public static final String INDENTCHARS
public static final String EMPTY_STRING
public static final String[] SYSTEM_PROPERTIES
public static String substitute(String aString, Map<String,String> variablesValues, String open, String close)
aString
. Variable names are delimited by open and close strings. The values
are retrieved from the given map.aString
- the string on which to apply the substitution.variablesValues
- a map containing the variable values. The keys are the variable names, the values are the variable values.open
- the open delimiter for variables.close
- the close delimiter for variables.public static String substitute(String aString, Map<String,String> variablesValues, String open, String close, int recursion)
aString
. Variable names are delimited by open and close strings. The values
are retrieved from the given map.aString
- the string on which to apply the substitution.variablesValues
- a map containg the variable values. The keys are the variable names, the values are the variable values.open
- the open delimiter for variables.close
- the close delimiter for variables.recursion
- the number of recursion (internal counter to avoid endless loops)public static String substituteHex(String aString)
aString
and convert them to operating system char equivalents in the return
string. Format is $[01] or $[6F,FF,00,1F] Example:
"This is a hex encoded six digits number 123456 in this string: $[31,32,33,34,35,36]"aString
- the string on which to apply the substitution.public static final String environmentSubstitute(String aString, Map<String,String> systemProperties)
aString
with the environment values in the system propertiesaString
- the string on which to apply the substitution.systemProperties
- the system properties to usepublic static String substituteUnix(String aString, Map<String,String> variables)
aString
. Variables are of the form "${aString
- the string on which to apply the substitution.variables
- a map containg the variable values. The keys are the variable names, the values are the variable values.public static String substituteWindows(String aString, Map<String,String> variables)
aString
. Variables are of the form "%%aString
- the string on which to apply the substitution.variables
- a map containg the variable values. The keys are the variable names, the values are the variable values.public static String substituteField(String aString, RowMetaInterface rowMeta, Object[] rowData) throws KettleValueException
aString
. Field values are of the form "?{aString
- the string on which to apply the substitution.rowMeta
- The row metadata to use.rowData
- The row data to useKettleValueException
- In case there is a String conversion errorpublic static boolean isSystemVariable(String aString)
public static void getUsedVariables(String aString, List<String> list, boolean includeSystemVariables)
public static final String generateRandomString(int length, String prefix, String postfix, boolean uppercase)
public static double str2num(String pattern, String decimal, String grouping, String currency, String value) throws KettleValueException
KettleValueException
public static final boolean isEmpty(String string)
string
- The string to checkpublic static final boolean isEmpty(StringBuffer string)
string
- The stringBuffer to checkpublic static Date str2dat(String arg0, String arg1, String val) throws KettleValueException
KettleValueException
public static String getIndent(int indentLevel)
public static String getFormattedDateTime(Date date)
date
- the date to convertpublic static String getFormattedDateTime(Date date, boolean milliseconds)
date
- the date to convertmilliseconds
- true when milliseconds should be addedpublic static String getFormattedDateTimeNow()
public static String getFormattedDateTimeNow(boolean milliseconds)
milliseconds
- true when milliseconds should be addedpublic static boolean IsInteger(String str)
public static boolean IsNumber(String str)
public static boolean IsDate(String str)