@Test public void testToBoolean() { assertEquals(true, TextUtil.toBoolean("True")); assertEquals(true, TextUtil.toBoolean("TRUE")); assertEquals(true, TextUtil.toBoolean("YES")); assertEquals(true, TextUtil.toBoolean("yEs")); assertEquals(true, TextUtil.toBoolean("on")); assertEquals(true, TextUtil.toBoolean("oN")); assertEquals(true, TextUtil.toBoolean("t")); assertEquals(true, TextUtil.toBoolean("Y")); assertEquals(false, TextUtil.toBoolean("false")); assertEquals(false, TextUtil.toBoolean("No")); assertEquals(false, TextUtil.toBoolean("")); assertEquals(false, TextUtil.toBoolean(".asef3")); assertEquals(false, TextUtil.toBoolean(null)); }
public static boolean toBoolean(String value) { String v = trimToNull(value); if (v == null) return false; v = v.toLowerCase(); return v.equals("true") || v.equals("t") || v.equals("yes") || v.equals("y") || v.equals("on"); }
TextUtil { public static boolean toBoolean(String value) { String v = trimToNull(value); if (v == null) return false; v = v.toLowerCase(); return v.equals("true") || v.equals("t") || v.equals("yes") || v.equals("y") || v.equals("on"); } }
TextUtil { public static boolean toBoolean(String value) { String v = trimToNull(value); if (v == null) return false; v = v.toLowerCase(); return v.equals("true") || v.equals("t") || v.equals("yes") || v.equals("y") || v.equals("on"); }  }
TextUtil { public static boolean toBoolean(String value) { String v = trimToNull(value); if (v == null) return false; v = v.toLowerCase(); return v.equals("true") || v.equals("t") || v.equals("yes") || v.equals("y") || v.equals("on"); }  static void println(PrintStream out, String pattern, Object... args); static void println(PrintStream out, int maxLineLength, String linePrefix, String pattern, Object... args); static void println(PrintStream out, int maxLineLength, String linePrefix, String content); static String format(String pattern, Object... args); static String repeat(String base, int repeat); static String padRight(String base, String repeatString, int totalLength); static String trimToNull(String source); static String nullToEmpty(String source); static String trimToEmpty(String source); static boolean toBoolean(String value); static List<String> wrap(String in, int length, String prefix, String wrappedLineIndent); static List<String> wrap(String in, int length); static int findFirstInstanceOf(String toBeSearched, int searchFrom, String... toBeFound); static int findLastInstanceOf(String toBeSearched, int searchFrom, String... toBeFound); static String escapeXml(String text); }
TextUtil { public static boolean toBoolean(String value) { String v = trimToNull(value); if (v == null) return false; v = v.toLowerCase(); return v.equals("true") || v.equals("t") || v.equals("yes") || v.equals("y") || v.equals("on"); }  static void println(PrintStream out, String pattern, Object... args); static void println(PrintStream out, int maxLineLength, String linePrefix, String pattern, Object... args); static void println(PrintStream out, int maxLineLength, String linePrefix, String content); static String format(String pattern, Object... args); static String repeat(String base, int repeat); static String padRight(String base, String repeatString, int totalLength); static String trimToNull(String source); static String nullToEmpty(String source); static String trimToEmpty(String source); static boolean toBoolean(String value); static List<String> wrap(String in, int length, String prefix, String wrappedLineIndent); static List<String> wrap(String in, int length); static int findFirstInstanceOf(String toBeSearched, int searchFrom, String... toBeFound); static int findLastInstanceOf(String toBeSearched, int searchFrom, String... toBeFound); static String escapeXml(String text); static final String[] EMPTY_STRING_ARRAY; static final List<String> EMPTY_STRING_LIST; static final String NULL_PRINT; static final String SECOND_LINE_INDENT; }