Android String to Boolean Convert getValueOrDefault(String s, String s1)

Here you can find the source of getValueOrDefault(String s, String s1)

Description

get Value Or Default

Declaration

public static String getValueOrDefault(String s, String s1) 

Method Source Code

//package com.java2s;

public class Main {
    public static String getValueOrDefault(String s, String s1) {
        String result = isEmpty(s).booleanValue() ? s1 : s;

        return result;
    }//ww w .  j  a v a  2s. c  o m

    public static Boolean isEmpty(String s) {
        boolean flag;
        if (s == null || s.length() == 0)
            flag = true;
        else
            flag = false;
        return Boolean.valueOf(flag);
    }
}

Related

  1. toBool(String str)
  2. toBoolean(final String value)
  3. getBool(String str, boolean b)
  4. toBool(String b)