List of utility methods to do String Value Of
E | valueOf(final Class Returns the enum constant of the specified enum type with the specified name. try { return Enum.valueOf(enumType, name); } catch (final IllegalArgumentException e) { return null; } catch (final NullPointerException e) { return null; |
String | valueOf(final Object obj, final String defaultValue)
Assertions : assertNull(StringHelper.valueOf(null, null)); assertEquals("", StringHelper.valueOf(null, "")); assertEquals("a", StringHelper.valueOf(null, "a")); assertEquals("foo", StringHelper.valueOf("foo", "a")); if (obj == null) { return defaultValue; } else { return String.valueOf(obj); |
String | valueOf(Object object, String defaultEmptyValue) value Of if (object == null) { return defaultEmptyValue; return String.valueOf(object); |
boolean | valueOf(String boolStr) Return the boolean value of an xsd:boolean type of DOM element/attribute.
return "true".equals(boolStr) || "1".equals(boolStr); |
int | valueOf(String decimal) value Of int index = decimal.indexOf("."); if (index > 0) { decimal = decimal.substring(0, index); return Integer.valueOf(decimal); |
String | valueOf(String first, String defaultstr) returns the value of the first parameter if set, otherwise a default value if ((first != null) && (first.length() > 0)) { return first; return defaultstr; |
double | valueOf(String format, String value) value Of double temp = Double.valueOf(value); return Double.valueOf(String.format(format, temp)); |
int | valueOf(String s) value Of if (!isNumeric(s)) { return 0; } else { return Integer.valueOf(s); |
Long | valueOf(String s) value Of try { return (Long.valueOf(s)); } catch (Exception e) { return 0L; |
int | valueOf(String s) value Of return !isNumeric(s) ? 0 : Integer.valueOf(s).intValue();
|