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

public static final boolean isSameMd5(String md51, String md52) {
    return md51 == null && md52 == null ? true
            : (md51 != null && md52 != null ? md51.toLowerCase().compareTo(md52.toLowerCase()) == 0 : false);
}

From source file:Main.java

private static void loadApplicationResources(Context context, Map<String, String> iconPackResources,
        String packageName) {/* www .ja  v a  2  s  . c o m*/
    Field[] drawableItems = null;
    try {
        Context appContext = context.createPackageContext(packageName,
                Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY);
        drawableItems = Class.forName(packageName + ".R$drawable", true, appContext.getClassLoader())
                .getFields();
    } catch (Exception e) {
        return;
    }
    for (Field f : drawableItems) {
        String name = f.getName();

        String icon = name.toLowerCase();
        name = name.replaceAll("_", ".");

        iconPackResources.put(name, icon);

        int activityIndex = name.lastIndexOf(".");
        if (activityIndex <= 0 || activityIndex == name.length() - 1) {
            continue;
        }

        String iconPackage = name.substring(0, activityIndex);
        if (TextUtils.isEmpty(iconPackage)) {
            continue;
        }
        iconPackResources.put(iconPackage, icon);

        String iconActivity = name.substring(activityIndex + 1);
        if (TextUtils.isEmpty(iconActivity)) {
            continue;
        }
        iconPackResources.put(iconPackage + "." + iconActivity, icon);
    }
}

From source file:Main.java

public static String replaceImgSuffix(String imgUrl) {
    String frontPartUrl = imgUrl.substring(0, imgUrl.lastIndexOf(".") + 1);
    String preSuffix = imgUrl.substring(imgUrl.lastIndexOf(".") + 1);
    String hindSuffix = "jpg";
    if (preSuffix.toLowerCase().equals("jpg")) {
        hindSuffix = "png";
    } else if (preSuffix.toLowerCase().equals("png")) {
        hindSuffix = "jpg";
    }/*from   ww w  .  jav  a  2s. com*/
    String newImgUrl = frontPartUrl + hindSuffix;

    return newImgUrl;
}

From source file:no.digipost.api.useragreements.client.filters.request.RequestMessageSignatureUtil.java

private static boolean isHeaderForSignature(final String key) {
    return HEADERS_FOR_SIGNATURE.contains(key.toLowerCase());
}

From source file:com.vamonossoftware.core.TextUtil.java

/**
 *
 *//*from w  w w.j ava2s . c  o  m*/
public static String hyperLink(String in) {
    if (in != null) {
        String[] tokens = in.split("\\s");
        StringBuilder sb = new StringBuilder();
        for (String token : tokens) {
            if (token.toLowerCase().startsWith("www.")) {
                sb.append("<a target=\"_blank\" href=\"http://" + token + "\">" + token + "</a>");
            } else if (token.toLowerCase().startsWith("http:")) {
                sb.append("<a target=\"_blank\" href=\"" + token + "\">" + token + "</a>");
            } else {
                sb.append(token);
            }
            sb.append(" ");
        }
        return sb.toString();
    }
    return in;
}

From source file:Main.java

public static int getDrawableResourceByName(Context context, String resourceName) {
    int result = -1;

    result = context.getResources().getIdentifier(
            resourceName.toLowerCase().replaceAll(" ", "").replaceAll(".png", ""), "drawable",
            context.getPackageName());//from ww w. java2s. c o  m

    return result;
}

From source file:Main.java

/**
 * Return the MIME type from the URI//from w w w.  j  a va2s  . c om
 * @param context Context
 * @param uri URI
 * @return Return the MIME type
 */
public static String getMimetypeFromUri(Context context, Uri uri) {
    String contentType = context.getContentResolver().getType(uri);
    if (TextUtils.isEmpty(contentType)) {
        final MimeTypeMap type_map = MimeTypeMap.getSingleton();
        // Get the extension from the path
        String extension = MimeTypeMap.getFileExtensionFromUrl(uri.toString());
        extension = extension.toLowerCase();
        if (extension.contains(".")) {
            extension = extension.substring(extension.lastIndexOf("."));
        }
        contentType = type_map.getMimeTypeFromExtension(extension);
    }
    return contentType;
}

From source file:Main.java

static public Node removeChild(Node xmlNode, String name, boolean ignoreCase) {
    Node removedChild = null;/*from w  w  w  .jav a 2  s. c  o  m*/

    String key = name;
    if (ignoreCase)
        key = key.toLowerCase();

    NodeList childNodes = xmlNode.getChildNodes();
    for (int i = 0; i < childNodes.getLength(); i++) {
        Node child = childNodes.item(i);
        String childName = child.getNodeName();
        if (ignoreCase)
            childName = childName.toLowerCase();

        if (childName.equals(key)) {
            removedChild = child;
            xmlNode.removeChild(child);
            break;
        }
    }
    return removedChild;
}

From source file:com.eryansky.common.orm.mybatis.dialect.db.SQLServer2005Dialect.java

static String getOrderByPart(String sql) {
    String loweredString = sql.toLowerCase();
    int orderByIndex = loweredString.indexOf("order by");
    if (orderByIndex != -1) {
        // if we find a new "order by" then we need to ignore
        // the previous one since it was probably used for a subquery
        return sql.substring(orderByIndex);
    } else {// w  w  w  . j  a  v a  2  s  . com
        return "";
    }
}

From source file:Main.java

public static boolean findIgnoreCase(String str, String c) {
    if (isNullOrEmpty(str)) {
        return false;
    }/*from  w w w.  jav  a2 s. c  o m*/
    return str.toLowerCase().indexOf(c.toLowerCase()) > -1;
}