List of utility methods to do String Value Of
Boolean | valueOf(String s) value Of return valueOf(parseBoolean(s));
|
long | valueOf(String s) value Of long time = 0L; for (String st : s.split(" ")) { if (st.endsWith("d")) { time += Long.valueOf(st.substring(0, st.length() - 1)) * 86400L; continue; if (st.endsWith("s")) { time += Long.valueOf(st.substring(0, st.length() - 1)); ... |
E | valueOf(String s, Class value Of try { return Enum.valueOf(e, s); } catch (IllegalArgumentException ex) { ex.printStackTrace(); return null; |
Integer | valueOf(String s, int def) This function always returns an int. try { return Integer.valueOf(s); } catch (Exception e) { return def; |
String | valueOf(String str) return "" if value is null otherwise return same string if (str == null) return ""; return str; |
Long | valueOf(String str) Parse String to Long. try { return Long.valueOf(str.trim()); } catch (Exception ex) { return null; |
boolean | valueOf(String stringVal, boolean dVal) value Of try { return Boolean.valueOf(stringVal); } catch (Exception e) { return dVal; |
boolean | valueOf(String value) Returns true if value equals "true", "on", "yes" or "1". if (value == null) { return false; value = value.trim().toLowerCase(); return (value.equals("true") || value.equals("on") || value.equals("yes") || value.equals("1")); |
boolean | valueOf(String value) Determines if the specified string contains 'true' or '1' return (value != null) && (value.trim().equalsIgnoreCase("true") || value.trim().equals("1")); |
boolean | valueOf(String value, boolean defaultValue) value Of if (value == null) return defaultValue; return Boolean.valueOf(value); |