List of utility methods to do String Value Of
Boolean | valueOfBoolean(final String s) value Of Boolean return Boolean.valueOf(parseBoolean(s));
|
int | valueOfBoolean(String string) Convert a Sting 'TRUE' to 1, otherwise 0. return string != null && "TRUE".equalsIgnoreCase(string) ? 1 : 0; |
Boolean | valueOfBooleanStr(String str) value Of Boolean Str return (Boolean.TRUE.equals(Boolean.valueOf(str)) || str.equalsIgnoreCase("yes")); |
E | valueOfEnum(Class value Of Enum try { if (value != null) { return Enum.valueOf(enumClass, value); } catch (Exception e) { return defaultValue; |
T | valueOfEnum(final Class Find the enum value of the given enum type with the given identifier (name). return Enum.valueOf(type, value);
|
T | valueOfIC(Class Returns an enum for enum class and string, ignoring case. for (T value : enumType.getEnumConstants()) if (value.toString().equalsIgnoreCase(aName)) return value; if (aName == null) throw new NullPointerException("Name is null"); throw new IllegalArgumentException("No enum const " + enumType + "." + aName); |
E | valueOfIgnoreCase(Class value Of Ignore Case for (E e : cls.getEnumConstants()) { if (e.toString().equalsIgnoreCase(value)) return e; throw new IllegalArgumentException(String.format("Unknown enum.value: ", value)); |
T | valueOfIgnoreCase(Class Works like #valueOf(Class,String) but ignores case. T[] constants = enumType.getEnumConstants(); if (constants == null) { return null; for (T constant : constants) { if (constant.name().equalsIgnoreCase(constantName)) { return constant; return null; |
Integer | valueOfInteger(final String s, int radix) value Of Integer return Integer.valueOf(parseInt(s));
|
long | valueOfIpv4(String ip) value Of Ipv long ret = 0; String[] p = ip.split("\\."); ret += Long.parseLong(p[0]) << 24; ret += Long.parseLong(p[1]) << 16; ret += Long.parseLong(p[2]) << 8; ret += Long.parseLong(p[3]); return ret; |