List of utility methods to do String to Boolean
boolean | atob(String s) atob return (s != null && (s.equals("1") || s.equalsIgnoreCase("true") || s.equalsIgnoreCase("yes"))); |
boolean | convertStringToBoolean(String pValue) convert String To Boolean boolean returnValue = false; if ("T".equals(pValue)) { returnValue = true; return returnValue; |
boolean | convertStringToBoolean(String strBoolean) Convert string to boolean. boolean theValue = Boolean.parseBoolean(strBoolean); return theValue; |
boolean | convertStringToBoolean(String string) convert String To Boolean if (string.equals("true")) { return true; } else { return false; |
Boolean | convertStringToBoolean(String string) Convert a string into an appropriate boolean value, true or false. Boolean bValue = null; if (string != null) { if ("1".equals(string) || "T".equalsIgnoreCase(string) || "Y".equalsIgnoreCase(string) || "true".equalsIgnoreCase(string) || "yes".equalsIgnoreCase(string)) { bValue = Boolean.TRUE; } else { bValue = Boolean.FALSE; return bValue; |
boolean | stringToBoolean(String expr) Converts a string to a boolean value, accepting "true", "t", "1", "yes" and "y" as true, accepting "false", "f", "0", "no", "n" as false, and throwing an IllegalArgumentException when none of these strings match. String cleanExpr = expr.toLowerCase().trim(); if (cleanExpr.equals("true") || cleanExpr.equals("t") || cleanExpr.equals("1") || cleanExpr.equals("yes") || cleanExpr.equals("y")) { return true; } else if (cleanExpr.equals("false") || cleanExpr.equals("f") || cleanExpr.equals("0") || cleanExpr.equals("no") || cleanExpr.equals("n")) { return false; } else { ... |
boolean[] | stringToBooleanArray(String string, String delim) string To Boolean Array StringTokenizer tokens = new StringTokenizer(string, delim); boolean[] ret = new boolean[tokens.countTokens()]; for (int i = 0; i < ret.length; i++) { ret[i] = tokens.nextToken().equals("T"); return ret; |