Java Boolean From toBool(String str)

Here you can find the source of toBool(String str)

Description

Returns a boolean representation of the provided string

License

Apache License

Parameter

Parameter Description
envVal a non-empty string

Declaration

private static boolean toBool(String str) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**/*from w w w. ja va2s.  c o m*/
     * Returns a boolean representation of the provided string
     * @param envVal a non-empty string
     */
    private static boolean toBool(String str) {
        switch (str.charAt(0)) {
        case 't':
        case 'T':
        case '1':
            return true;
        default:
            return false;
        }
    }
}

Related

  1. toBool(int[] data, int index)
  2. toBool(long l)
  3. toBool(String bStr)
  4. toBool(String bv)
  5. toBool(String str)
  6. toBool(String v, boolean def)
  7. toBool(String val)
  8. toBool(String val, boolean def)
  9. toBoolean(boolean b)