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 String generateReversedCast(String javaType) {

    if (javaType.toLowerCase().equals("byte"))
        return "byte_";
    if (javaType.toLowerCase().equals("short"))
        return "int16";
    if (javaType.toLowerCase().equals("long") || javaType.toLowerCase().equals("double"))
        return "decimal";
    if (javaType.toLowerCase().equals("float"))
        return "single";
    if (javaType.toLowerCase().equals("int"))
        return "int32";
    if (javaType.toLowerCase().equals("boolean"))
        return "boolean_";
    if (javaType.toLowerCase().equals("string") || javaType.toLowerCase().equals("char"))
        return "string";
    if (javaType.toLowerCase().equals("date"))
        return "datetime";
    if (javaType.toLowerCase().equals("time"))
        return "string";

    return "string";
}

From source file:Main.java

/**
 * Creates a string with the given backgroundcolor.
 *
 * @param str   String to be colorized.//from ww w  .ja  v a 2 s .  c  o  m
 * @param color Constant defined color (see constants).
 * @return String with internal markup-sequences.
 */
public static String colorizeBackground(String str, String color) {
    return INTERNAL_MARKER + color.toLowerCase() + str + INTERNAL_MARKER + RESET_ALL;
}

From source file:Main.java

public final static String initCap(String s) {
    String str = "";
    try {//  www.  j ava  2 s. c  om
        str = s.toLowerCase();
        char[] ca = str.toCharArray();
        char c = new String(new char[] { ca[0] }).toUpperCase().toCharArray()[0];
        ca[0] = c;
        str = new String(ca);
    } catch (Exception ignore) {
    }

    return str;
}

From source file:Main.java

public static Class getClass(String name) {
    return (Class) class_string_mapping.get(name.toLowerCase());
}

From source file:Main.java

/**
 * @return a valid string to use as id, based on the given String. All invalid
 * characters are removed./*from  w  ww  .j a  va  2  s.c  o m*/
 */
public static String getValidIdString(String s) {
    if (s != null) {
        return s.toLowerCase().replace(" ", "").replace("_", "").replace("-", "_");
    }
    return null;
}

From source file:Main.java

/**
 * Get the file extension of the file so data type can be identified
 * @param url the url of the file address
 * @return the file extension//from  ww  w .j a  v  a2  s  . c om
 */
public static String getFileExtension(String url) {
    String extension = url.substring(url.lastIndexOf(".") + 1);
    extension = extension.toLowerCase();
    return extension;
}

From source file:Main.java

/**
 * Calculates the Levenshtein distance between two strings
 *
 * @link Reference & Created by http://rosettacode.org/wiki/Levenshtein_distance#Java
 *//* w  w  w. ja v a2s  . co  m*/
public static int editDistance(String s1, String s2) {
    s1 = s1.toLowerCase();
    s2 = s2.toLowerCase();

    int[] costs = new int[s2.length() + 1];
    for (int i = 0; i <= s1.length(); i++) {
        int lastValue = i;
        for (int j = 0; j <= s2.length(); j++) {
            if (i == 0) {
                costs[j] = j;
            } else {
                if (j > 0) {
                    int newValue = costs[j - 1];
                    if (s1.charAt(i - 1) != s2.charAt(j - 1)) {
                        newValue = Math.min(Math.min(newValue, lastValue), costs[j]) + 1;
                    }
                    costs[j - 1] = lastValue;
                    lastValue = newValue;
                }
            }
        }
        if (i > 0) {
            costs[s2.length()] = lastValue;
        }
    }
    return costs[s2.length()];
}

From source file:Main.java

public static String normalize(String s) {
    if (s == null)
        return "";

    s = s.toLowerCase();
    s = regex_norm.matcher(s).replaceAll(" ").trim();
    s = regex_ws.matcher(s).replaceAll("_");

    return s;//from   www .  j a va  2  s.  c  o  m
}

From source file:Main.java

/**
 * Return well-written format for Bio2RDF REST service
 * /*from w w  w.j  ava  2s.c  o m*/
 * 
 * {talendTypes} String
 * 
 * {Category} User Defined
 * 
 * {param} string("format")
 * 
 * {example} restFormat("rdf")
 */
public static String getFormatFromMime(String formatIn) {
    if (formatIn.toLowerCase().equals("rdf") || formatIn.toLowerCase().equals("rdfxml")
            || formatIn.toLowerCase().equals("application/rdf+xml")) {
        return ("rdfxml");
    } else if (formatIn.toLowerCase().equals("n3") || formatIn.toLowerCase().equals("text/rdf+n3")) {
        return ("n3");
    } else if (formatIn.toLowerCase().equals("ttl") || formatIn.toLowerCase().equals("turtle")
            || formatIn.toLowerCase().equals("text/turtle")) {
        return ("turtle");
    } else if (formatIn.toLowerCase().equals("nt") || formatIn.toLowerCase().equals("text/plain")
            || formatIn.toLowerCase().equals("ntriple") || formatIn.toLowerCase().equals("ntriples")) {
        return ("ntriple");
    } else if (formatIn.toLowerCase().equals("json") || formatIn.toLowerCase().equals("application/rdf+json")
            || formatIn.toLowerCase().equals("rdfjson")) {
        return ("rdfjson");
    } else if (formatIn.toLowerCase().equals("jsonld") || formatIn.toLowerCase().equals("application/x-json+ld")
            || formatIn.toLowerCase().equals("application/ld+json")
            || formatIn.toLowerCase().equals("application/json") || formatIn.toLowerCase().equals("ldjson")) {
        return ("jsonld");
    } else if (formatIn.toLowerCase().equals("trig") || formatIn.toLowerCase().equals("application/x-trig")
            || formatIn.toLowerCase().equals("application/trig")) {
        return ("trig");
    } else {
        System.err.println("Incompatible format");
        return ("null");
    }
}

From source file:Main.java

public static int getPeripheralsLeftIconResourceId(Resources resources, String drawableName, Context context) {
    return resources.getIdentifier(photo + drawableName.toLowerCase(), "drawable", context.getPackageName());
}