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

static public String getTagAttributeValue(String inputTXT, String tag, String attribute) {
    String content = "";
    String inputLowCase = inputTXT.toLowerCase();
    String tagStart = "<" + tag.toLowerCase() + " ";
    int idx_tagStart = inputLowCase.indexOf(tagStart);
    if (idx_tagStart == -1) {
        tagStart = "<" + tag.toLowerCase() + "\t";
        idx_tagStart = inputLowCase.indexOf(tagStart);
        if (idx_tagStart == -1) {
            System.out.println("No start");
            return content;
        }/*from  w  w w .  j a  v  a  2  s .  co m*/
    }
    String tagAttribute = attribute.toLowerCase();
    int idx_tagAttr = inputLowCase.indexOf(tagAttribute, idx_tagStart);
    if (idx_tagAttr == -1) {
        System.out.println("No attribute");
        return content;
    }
    int idx_tagAttrValue = inputLowCase.indexOf("\"", idx_tagAttr);
    if (idx_tagAttrValue == -1) {
        System.out.println("No value start");
        return content;
    }
    int idx_tagAttrValueEnd = inputLowCase.indexOf("\"", idx_tagAttr);
    if (idx_tagAttrValueEnd == -1) {
        System.out.println("No value end");
        return content;
    }
    content = inputTXT.substring(idx_tagAttrValue + 1, idx_tagAttrValueEnd);
    return content;
}

From source file:AIR.Common.Configuration.AppSettings.java

public static Object parseString(String type, String value) {
    switch (type.toLowerCase()) {
    case "boolean":
        return new Boolean(value);
    case "integer":
        return new Integer(value);
    default:/*from w  w w  .  j  ava 2  s .  c  o  m*/
        return value; // default also covers "string"
    }
}

From source file:Main.java

/**
 * Handle various common charset name errors, and return something
 * that will be considered valid (and is normalized)
 * //from ww w. j  av a 2s  .c o m
 * @param charsetName name of charset to process
 * @return potentially remapped/cleaned up version of charset name
 */
public static String clean(String charsetName) {
    if (charsetName == null) {
        return null;
    }

    // Get rid of cruft around names, like <>, trailing commas, etc.
    Matcher m = CHARSET_NAME_PATTERN.matcher(charsetName);
    if (!m.matches()) {
        return null;
    }

    String result = m.group(1);
    if (CHARSET_ALIASES.containsKey(result.toLowerCase())) {
        // Handle common erroneous charset names.
        result = CHARSET_ALIASES.get(result.toLowerCase());
    } else if (ISO_NAME_PATTERN.matcher(result).matches()) {
        // Handle "iso 8859-x" error
        m = ISO_NAME_PATTERN.matcher(result);
        m.matches();
        result = "iso-8859-" + m.group(1);
    } else if (CP_NAME_PATTERN.matcher(result).matches()) {
        // Handle "cp-xxx" error
        m = CP_NAME_PATTERN.matcher(result);
        m.matches();
        result = "cp" + m.group(1);
    } else if (WIN_NAME_PATTERN.matcher(result).matches()) {
        // Handle "winxxx" and "win-xxx" errors
        m = WIN_NAME_PATTERN.matcher(result);
        m.matches();
        result = "windows-" + m.group(2);
    }

    try {
        Charset cs = Charset.forName(result);
        return cs.name();
    } catch (Exception e) {
        return null;
    }
}

From source file:com.flexive.shared.search.FxSQLFunctions.java

/**
 * Converts the given function names to {@link FxSQLFunction} objects. If an entry does not
 * represent a known FxSQL function, a FxRuntimeException is thrown.
 *
 * @param values    the function names to be converted
 * @return          the {@link FxSQLFunction} objects
 *///from  www. j a va  2  s  .co m
public static List<FxSQLFunction> asFunctions(Collection<String> values) {
    final List<FxSQLFunction> result = new ArrayList<FxSQLFunction>(values.size());
    for (String value : values) {
        if (!FUNCTIONS.containsKey(value.toLowerCase())) {
            throw new FxNotFoundException("ex.sqlSearch.function.notFound", value,
                    StringUtils.join(getSqlNames(FUNCTIONS.values()), ", ")).asRuntimeException();
        }
        result.add(FUNCTIONS.get(value.toLowerCase()));
    }
    return result;
}

From source file:com.quui.chat.Preprocessor.java

/**
 * Cleans all occurences and almost-occurences (Levenshtein Distance) of
 * nick in message.//from   w  w  w  .ja v a2 s  . co m
 * @param message The message to clean
 * @param nick The nick to clean from the message
 * @return The cleaned message
 */
static public String clean(String message, String nick) {

    String[] toks = message.toLowerCase().split("[^?!'\\p{L}]");
    String[] nickToks = nick.toLowerCase().split("[^\\p{L}]");
    for (int j = 0; j < toks.length; j++) {
        for (int i = 0; i < nickToks.length; i++) {
            int dist = StringUtils.getLevenshteinDistance(toks[j], nickToks[i]);
            if (dist < 2 && toks[j].length() > 3 && nickToks[i].length() > 3) {// ||
                Log.logger
                        .debug("Cutting out, L-Dist zw. " + toks[j] + " und " + nickToks[i] + " ist: " + dist);
                toks[j] = "";
            }
        }

    }
    String result = "";
    for (int j = 0; j < toks.length; j++) {
        result = (result + toks[j].trim()).trim() + " ";
    }
    return result.trim();
}

From source file:org.web4thejob.web.util.MediaUtil.java

public static boolean isImage(String mediaFormat) {
    mediaFormat = mediaFormat.toLowerCase();
    return "png".equals(mediaFormat) || "jpg".equals(mediaFormat) || "gif".equals(mediaFormat);
}

From source file:de.tudarmstadt.ukp.experiments.argumentation.convincingness.sampling.IOHelper.java

public static String createFileName(DebateMetaData metaData, String stance) {
    return metaData.getTitle().toLowerCase().replaceAll("\\W+", "-") + "_"
            + stance.toLowerCase().replaceAll("\\W+", "-") + ".xml";
}

From source file:com.daphne.es.maintain.staticresource.web.controller.utils.YuiCompressorUtils.java

public static boolean hasCompress(String fileName) {
    return fileName.toLowerCase().endsWith(".min.js") || fileName.endsWith(".min.css");
}

From source file:MiscUtils.java

/**
 * // 2000????html????htm????????????????????#????
 * /*from  w  w  w.j  av  a2s .c o m*/
 * @param os
 *            OS?
 * @param url
 *            ??URL
 * @return URL???
 */
private static String appendUrlForWindows2000(final String os, final String url) {
    String ret = url;
    if (os.indexOf("2000") != -1) {
        if (url.toLowerCase().endsWith(".html") || url.toLowerCase().endsWith(".htm")) {
            ret += "#";
        }
    }
    return ret;
}

From source file:com.silverpeas.gallery.constant.StreamingProvider.java

/**
 * Retrieves from the specified string the streaming provider.
 * @param provider the exact string of the provider (it is not case sensitive)
 * @return the streaming provider found if any, {@link #unknown} otherwise.
 *//*from w w w  .j a v  a2s. co m*/
@JsonCreator
public static StreamingProvider from(String provider) {
    try {
        return valueOf(provider.toLowerCase());
    } catch (Exception e) {
        return unknown;
    }
}