Example usage for java.lang String equalsIgnoreCase

List of usage examples for java.lang String equalsIgnoreCase

Introduction

In this page you can find the example usage for java.lang String equalsIgnoreCase.

Prototype

public boolean equalsIgnoreCase(String anotherString) 

Source Link

Document

Compares this String to another String , ignoring case considerations.

Usage

From source file:Main.java

private static String getStrInMapIgnoreCase(String key, Map<String, Object> map) {
    Set<String> keySet = map.keySet();
    for (String keyInMap : keySet) {
        if (key.equalsIgnoreCase(keyInMap)) {
            return keyInMap;
        }/*from  w w  w. j  a  v a2 s  . co  m*/
    }
    return null;
}

From source file:Main.java

@SuppressWarnings({ "deprecation" })
public static String getNetWorkType(Context context) {
    String mNetWorkType = null;// w  w  w  .  j a  v a 2 s . c  om
    ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    if (manager == null) {
        return "ConnectivityManager not found";
    }
    NetworkInfo networkInfo = manager.getActiveNetworkInfo();
    if (networkInfo != null && networkInfo.isConnected()) {
        String type = networkInfo.getTypeName();
        if (type.equalsIgnoreCase("WIFI")) {
            mNetWorkType = NETWORKTYPE_WIFI;
        } else if (type.equalsIgnoreCase("MOBILE")) {
            String proxyHost = android.net.Proxy.getDefaultHost();
            if (TextUtils.isEmpty(proxyHost)) {
                mNetWorkType = mobileNetworkType(context);
            } else {
                mNetWorkType = NETWORKTYPE_WAP;
            }
        }
    } else {
        mNetWorkType = NETWORKTYPE_INVALID;
    }
    return mNetWorkType;
}

From source file:AIR.Common.Utilities.JavaPrimitiveUtils.java

public static <E extends java.lang.Enum<E>> boolean enumTryParse(Class<E> enumType, String value,
        boolean ignoreCase, _Ref<E> out) {
    E[] enumsConstants = enumType.getEnumConstants();
    for (E e : enumsConstants) {
        String n = e.name();
        if (ignoreCase ? n.equalsIgnoreCase(value) : n.equals(value)) {
            out.set(e);//w w w .jav  a 2 s.  c o m
            return true;
        }
    }
    return false;
}

From source file:net.duckling.ddl.util.PictureCheckCodeUtil.java

/**
 * ?request?????????//from   w  ww .ja va  2s .  co  m
 * @param request
 * @param code
 * @param type
 * @param reflesh true typesession??false?
 * @return
 */
public static boolean checkCode(HttpServletRequest request, String code, String type, boolean reflesh) {
    if (StringUtils.isEmpty(type) || StringUtils.isEmpty(code)) {
        return false;
    }
    String c = (String) request.getSession().getAttribute(type);
    if (!StringUtils.isEmpty(c) && c.equalsIgnoreCase(code)) {
        if (reflesh) {
            request.getSession().removeAttribute(type);
        }
        return true;
    } else {
        request.getSession().removeAttribute(type);
        return false;
    }

}

From source file:net.sf.ehcache.util.PropertyUtil.java

/**
 * Null safe, parser of boolean from a String
 * @param value//ww w .  ja  va2s . c  o  m
 * @return true if non null and case insensitively matches true
 */
public static boolean parseBoolean(String value) {
    return ((value != null) && value.equalsIgnoreCase("true"));
}

From source file:com.autentia.common.util.PasswordUtils.java

private static boolean checkIfpasswordsAreEquals(String newPwd, String pwd) {
    return newPwd.equalsIgnoreCase(pwd);
}

From source file:com.wso2telco.dep.mediator.impl.wallet.WalletHandlerFactory.java

public static WalletHandler createWalletHandler(String resourceURL, WalletExecutor executor) {

    WalletHandler walletHandler = null;//www  .j a va 2  s. co  m
    String transactionOperationStatus = null;
    log.debug("createPaymentHandler -> Json string : " + executor.getJsonBody().toString());

    String httpMethod = executor.getHttpMethod();

    if (httpMethod.equalsIgnoreCase("post")) {
        if (resourceURL.contains("payment")) {
            log.debug("createWalletHandler -> Wallet API type : payment");
            walletHandler = new WalletPaymentHandler(executor);

        } else if (resourceURL.contains("refund")) {
            walletHandler = new WalletRefundHandler(executor);

        }
    } else if (httpMethod.equalsIgnoreCase("get")) {
        if (resourceURL.contains("/list")) {
            log.debug("createWalletHandler -> Wallet API type : list");
            walletHandler = new WalletListHandler(executor);

        } else if (resourceURL.contains("/balance")) {
            log.debug("createWalletHandler -> Wallet API type : balance");
            walletHandler = new WalletBalanceHandler(executor);

        } else {
            log.debug("createWalletHandler -> API Type Not found");
            throw new CustomException("SVC0002", "", new String[] { null });
        }
    } else {
        log.debug("createPaymentHandler -> API Type Not found");
        throw new CustomException("SVC0002", "", new String[] { null });
    }

    return walletHandler;
}

From source file:Main.java

public static boolean rightType(String fileType, String ftype) {
    if (fileType == null || fileType.length() == 0) {
        return true;
    }/*from  w  w  w.  j a v  a  2 s.co  m*/
    if (fileType.equalsIgnoreCase("*"))
        return true;
    String[] fileTypes = fileType.split(",");
    for (int i = 0; i < fileTypes.length; i++) {
        if (fileTypes[i].equalsIgnoreCase(ftype)) {
            return true;
        }
    }
    return false;
}

From source file:com.joyent.manta.client.crypto.SupportedHmacsLookupMap.java

/**
 * Wraps a getInstance call as a {@link Supplier} so that we can return a
 * new HMAC instance for every value of this map.
 *
 * @param algorithm algorithm to instantiate HMAC instance as
 * @return supplier wrapping getInstance call to get HMAC instance
 *///from   w  w  w . j  a  v a  2  s  .  co  m
private static Supplier<HMac> hmacSupplierByName(final String algorithm) {
    return () -> {
        if (algorithm.equalsIgnoreCase("HmacMD5")) {
            return new HMac(new FastMD5Digest());
        } else if (algorithm.equalsIgnoreCase("HmacSHA1")) {
            return new HMac(new SHA1Digest());
        } else if (algorithm.equalsIgnoreCase("HmacSHA256")) {
            return new HMac(new SHA256Digest());
        } else if (algorithm.equalsIgnoreCase("HmacSHA384")) {
            return new HMac(new SHA384Digest());
        } else if (algorithm.equalsIgnoreCase("HmacSHA512")) {
            return new HMac(new SHA512Digest());
        } else {
            String msg = String.format("Hmac algorithm [%s] not supported", algorithm);
            throw new MantaClientEncryptionException(msg);
        }
    };
}

From source file:net.dv8tion.jda.utils.AvatarUtil.java

public static Avatar getAvatar(File avatarFile) throws UnsupportedEncodingException {
    String[] split = avatarFile.getName().split("\\.");
    String type = split[split.length - 1];
    if (type.equalsIgnoreCase("jpg") || type.equalsIgnoreCase("jpeg") || type.equalsIgnoreCase("png")) {
        try {//from w ww .  j a va  2s .  com
            //reading
            BufferedImage img = ImageIO.read(avatarFile);
            return getAvatar(img);
        } catch (IOException e) {
            JDAImpl.LOG.log(e);
        }
    } else {
        throw new UnsupportedEncodingException("Image type " + type + " is not supported!");
    }
    return null;
}