package com.qmth.exam.reserve.util;

public class BooleanUtil {

    /**
     * Boolean值判断
     * 兼容：【true,false】【yes,no】【1,0】，null值返回false
     */
    public static boolean isTrue(String value) {
        if (value == null) {
            return false;
        }
        return "true".equalsIgnoreCase(value)
                || "yes".equalsIgnoreCase(value)
                || "1".equals(value);
    }

    /**
     * Boolean值判断
     * 兼容：【true,false】【yes,no】【1,0】，null值返回true
     */
    public static boolean isFalse(String value) {
        if (value == null) {
            return true;
        }
        return "false".equalsIgnoreCase(value)
                || "no".equalsIgnoreCase(value)
                || "0".equals(value);
    }

}
