Convert string To Bool - Android java.lang

Android examples for java.lang:Boolean

Description

Convert string To Bool

Demo Code


public class Main{

    public static boolean stringToBool(String s) {
        if (s.toUpperCase().compareTo("FALSE") == 0)
            return false;
        else if (s.length() == 0)
            return false;
        else if (s.compareTo("0") == 0)
            return false;
        return true;
    }/*  ww w.  jav  a 2 s.  co  m*/

}

Related Tutorials