Example usage for java.lang String toLowerCase

List of usage examples for java.lang String toLowerCase

Introduction

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

Prototype

public String toLowerCase() 

Source Link

Document

Converts all of the characters in this String to lower case using the rules of the default locale.

Usage

From source file:Main.java

@SuppressLint("DefaultLocale")
public static String getAPNTypeString(Context context) {
    String netType = "";
    ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();

    if (networkInfo != null) {
        int nType = networkInfo.getType();
        if (nType == ConnectivityManager.TYPE_MOBILE) {
            String eInfo = networkInfo.getExtraInfo();
            if (eInfo != null) {
                netType = eInfo.toLowerCase();

            }/*  w ww .  j a  v a  2s . co  m*/
        } else if (nType == ConnectivityManager.TYPE_WIFI) {
            netType = "wifi";
        }
    }

    return netType;
}

From source file:com.opengamma.web.bundle.BundleType.java

/**
 * Lookup the type using the file suffix.
 * //from   w  ww . j  a v a2 s  .c  o  m
 * @param fileName  the file name including the suffix, null returns null
 * @return the bundle type, null if unable to determine
 */
public static BundleType getType(final String fileName) {
    if (StringUtils.isNotBlank(fileName)) {
        if (fileName.toLowerCase().endsWith("." + JS.getSuffix())) {
            return JS;
        } else if (fileName.toLowerCase().endsWith("." + CSS.getSuffix())) {
            return CSS;
        }
    }
    return null;
}

From source file:Main.java

private static String singleTagFormat(String originStr, String originTag, String destinTag) {
    originTag = originTag.toUpperCase();
    String originLowTag = originTag.toLowerCase();
    String reg = "((&lt;)|<)\\s*(\\/)?\\s*((" + originTag + ")|(" + originLowTag
            + "))\\s*((\\\\)|(\\/))?\\s*(>|(&gt;))";
    String temp = originStr.replaceAll(reg, destinTag);
    return temp;//from  w  w  w .j  a  v  a 2  s.  c om
}

From source file:com.censoredsoftware.library.util.StringUtil2.java

/**
 * Automatically removes underscores and returns a capitalized version of the given <code>string</code>.
 *
 * @param string the string the beautify.
 *//*  w ww  .j av  a  2s. co m*/
public static String beautify(String string) {
    return StringUtils.capitalize(string.toLowerCase().replace("_", " "));
}

From source file:io.github.robolib.util.mapper.SpeedControllerMapper.java

public static final void registerController(Class<? extends SpeedController> con, String... keys) {
    for (String key : keys) {
        if (m_controllMap.containsKey(key.toLowerCase())) {
            Logger.get(RobotMap.class)
                    .warn("SpeedControllerBuilder already contains a an item for key '" + key + "'.");
        } else {/*from  w w w.  j  a v a 2  s. c  o  m*/
            m_controllMap.put(key.toLowerCase(), con);
        }
    }
}

From source file:com.mashape.galileo.agent.common.IPAddressParserUtil.java

private static boolean isValidIp(final String ip) {
    String ipAdress = ip.toLowerCase().trim();
    return InetAddressUtils.isIPv4Address(ipAdress) || InetAddressUtils.isIPv6Address(ipAdress);
}

From source file:Main.java

/**********************************************************************/

public static boolean containsAtLeastOne(String src, String[] strings) {
    // TODO: regex isn't good enough - doesn't work with the start or end of line
    src = src.toLowerCase();
    for (String s : strings) {
        Pattern p = Pattern.compile(".*[^a-z]" + s + "[^a-z].*");
        Matcher m = p.matcher(src);
        if (m.matches()) {
            return true;
        }/*from   ww w.  j  a  v  a2  s .  c  o  m*/
    }
    return false;
}

From source file:org.createnet.raptor.auth.service.acl.RaptorPermission.java

public static Permission fromLabel(String name) {
    switch (name.toLowerCase()) {
    case "read":
        return RaptorPermission.READ;
    case "update":
        return RaptorPermission.WRITE;
    case "create":
        return RaptorPermission.CREATE;
    case "delete":
        return RaptorPermission.DELETE;
    case "admin":
        return RaptorPermission.ADMINISTRATION;
    case "push":
        return RaptorPermission.PUSH;
    case "pull":
        return RaptorPermission.PULL;
    case "subscribe":
        return RaptorPermission.SUBSCRIBE;
    case "execute":
        return RaptorPermission.EXECUTE;
    case "list":
        return RaptorPermission.LIST;
    }//from  w  w w.  j a va2  s  .c o  m
    return null;
}

From source file:com.jsmartframework.web.util.WebUtils.java

public static String randomId() {
    final byte[] bytes = new byte[DEFAULT_RANDOM_BYTES];
    random.nextBytes(bytes);//from   w ww .  java 2 s  . c om
    String base32String = base32.encodeAsString(bytes);
    return base32String.toLowerCase().replace("=", "");
}

From source file:Main.java

/**
 * Returns whether the device has Ad blocking entries in it's host file or not.
 * @return true if Ad blocking entries where detected, false if not.
 *//*from w ww  . j a  v a 2  s. co  m*/
public static Boolean isAdBlockActive() {
    try {
        BufferedReader bufferedReader = new BufferedReader(
                new InputStreamReader(new FileInputStream("/etc/hosts")));
        String currentLine;
        while ((currentLine = bufferedReader.readLine()) != null) {
            if (currentLine.toLowerCase().contains("admob"))
                return true;
        }
    } catch (IOException io) {
        io.printStackTrace();
    }
    return false;
}