public final class Global extends Object
| Constructor and Description |
|---|
Global() |
| Modifier and Type | Method and Description |
|---|---|
static Object |
coalesce(Object... objects)
Finds the first non-null object.
|
static String |
concat(String a,
String b)
Concats two string without any separator in between.
|
static String |
concat(String a,
String delim,
String b)
Concats two string with a delimiter.
|
static String |
format(String str,
Object... args)
Formats the string in way similar to String format.
|
static String |
padAtEnd(String string,
int minLength,
char padChar)
Returns a string, of length at least
minLength, consisting of string appended
with as many copies of padChar as are necessary to reach that length. |
static String |
padAtStart(String string,
int minLength,
char padChar)
Returns a string, of length at least
minLength, consisting of string prepended
with as many copies of padChar as are necessary to reach that length. |
static Object |
rcoalesce(Object... objects)
Finds the last non-null object.
|
static String |
repeat(String string,
int count)
Returns a string consisting of a specific number of concatenated copies of an input string.
|
static byte[] |
toBytes(String value)
Converts a String value to byte array.
|
static double |
toDouble(String value)
Converts String value to double.
|
static float |
toFloat(String value)
Coverts a String value to float.
|
static int |
toInteger(String value)
Converts a String value to integer.
|
static long |
toLong(String value)
Converts a String value to Long.
|
static String |
unquote(String string)
This String util method removes single or double quotes
from a string if its quoted.
|
public static double toDouble(String value)
value - of type String to be converted to double.public static float toFloat(String value)
value - of type string to be converted to float.public static long toLong(String value)
value - of type string to be converted to float.public static int toInteger(String value)
value - of type string to be converted to integer.public static byte[] toBytes(String value)
value - of type string to be converted to byte array.public static String concat(String a, String b)
a - First stringb - Second Stringpublic static String concat(String a, String delim, String b)
a - first string.delim - delimiter.b - second string.public static Object coalesce(Object... objects)
objects - to be check for null.public static Object rcoalesce(Object... objects)
objects - to be check for null.public static String format(String str, Object... args)
str - format of string.args - arguments to included in the string.public static String padAtStart(String string, int minLength, char padChar)
minLength, consisting of string prepended
with as many copies of padChar as are necessary to reach that length. For example,
padStart("7", 3, '0') returns "007"
padStart("2010", 3, '0') returns "2010"
public static String padAtEnd(String string, int minLength, char padChar)
minLength, consisting of string appended
with as many copies of padChar as are necessary to reach that length. For example,
padEnd("4.", 5, '0') returns "4.000"
padEnd("2010", 3, '!') returns "2010"
public static String repeat(String string, int count)
repeat("hey", 3) returns the string "heyheyhey".string - any non-null stringcount - the number of times to repeat it; a nonnegative integerstring repeated count times (the empty string if
count is zero)IllegalArgumentException - if count is negativepublic static String unquote(String string)
string - value to be unquoted.Copyright © 2020 CDAP Licensed under the Apache License, Version 2.0.