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:com.mashape.galileo.agent.common.IPAddressParserUtil.java

private static String findForwadedClientIpAddress(String headerValue) {
    String[] forwardedPairs = headerValue.toLowerCase().trim().split(";");
    for (String pair : forwardedPairs) {
        if (pair.trim().startsWith("for=")) {
            String forwardedPair = pair.trim();
            String forValue;//from ww w  . j  a  v a 2 s .  c  o  m
            if (forwardedPair.contains(",")) {
                String[] forpairs = forwardedPair.split(",");
                String forPair = forpairs[0];
                if (forPair.contains("for=")) {
                    forValue = forPair.substring(forPair.indexOf("for=") + 4, forPair.length()).trim();
                } else {
                    return null;
                }
            } else {
                forValue = forwardedPair.substring(forwardedPair.indexOf("for=") + 4, forwardedPair.length())
                        .trim();

            }
            if (forValue.matches("\"\\[.*\\]:\\d*\"")) {
                forValue = forValue.substring(2, forValue.indexOf("]"));
            } else if (forValue.matches(".*:\\d*")) {
                forValue = forValue.split(":")[0];
            }
            return forValue;
        }
    }
    return null;
}

From source file:Main.java

public static String getContentType(String attFormat) {
    String contentType = FORMAT_TO_CONTENTTYPE.get("null");

    if (attFormat != null) {
        contentType = (String) FORMAT_TO_CONTENTTYPE.get(attFormat.toLowerCase());
    }/*from  w w w .j  av  a  2  s  . c o  m*/
    return contentType;
}

From source file:org.opencastproject.remotetest.server.resource.WorkflowResources.java

/**
 * // www.  j a va2 s.c  o  m
 * @param format Response format: xml or json
 * 
 */
public static HttpResponse instances(TrustedHttpClient client, String format) throws Exception {
    return client.execute(new HttpGet(getServiceUrl() + "instances." + format.toLowerCase()));
}

From source file:com.adguard.commons.utils.CharsetUtils.java

/**
 * Extracts Charset from Content-Type header value
 *
 * @param contentType    Content-Type header value
 * @param defaultCharset Will be returned if no charset found
 * @return Charset or defaultCharset//from ww w .  ja v  a 2 s .c  o  m
 */
public static Charset forContentType(String contentType, Charset defaultCharset) {
    try {
        if (!StringUtils.isEmpty(contentType)) {
            String[] parts = StringUtils.split(contentType, ';');

            for (String t1 : parts) {
                String t = t1.trim();
                int index = t.toLowerCase().indexOf("charset=");
                if (index != -1) {
                    String charset = t.substring(index + 8);
                    String charset1 = StringUtils.split(charset, ",;")[0];
                    return forName(charset1, defaultCharset);
                }
            }
            return defaultCharset;
        }

        return defaultCharset;
    } catch (Exception ex) {
        log.debug(String.format("Cannot extract charset from %s", contentType), ex);
        return defaultCharset;
    }
}

From source file:Main.java

private static String pairTagFormat(String originStr, String originTag, String destinStartTag,
        String destinEndTag) {/*from   w w w . j  ava2  s.  co  m*/
    originTag = originTag.toUpperCase();
    String originLowTag = originTag.toLowerCase();
    String reg = "((&lt;)|<)\\s*((" + originTag + ")|(" + originLowTag + "))\\s*(>|(&gt;))";
    String temp = originStr.replaceAll(reg, destinStartTag);
    reg = "((&lt;)|<)\\s*(\\/)\\s*((" + originTag + ")|(" + originLowTag + "))\\s*(>|(&gt;))";
    temp = temp.replaceAll(reg, destinEndTag);
    return temp;
}

From source file:org.opencastproject.remotetest.server.resource.WorkflowResources.java

/**
 * //from  w w  w . ja v  a 2  s.  c  o m
 * @param format Response format: xml or json
 * 
 */
public static HttpResponse definitions(TrustedHttpClient client, String format) throws Exception {
    return client.execute(new HttpGet(getServiceUrl() + "definitions." + format.toLowerCase()));
}

From source file:com.linkedin.pinot.core.query.pruner.SegmentPrunerProvider.java

public static SegmentPruner getSegmentPruner(String prunerClassName, Configuration segmentPrunerConfig) {
    try {/* w w  w.  j ava  2s.  c o m*/
        Class<? extends SegmentPruner> cls = keyToFunction.get(prunerClassName.toLowerCase());
        if (cls != null) {
            SegmentPruner segmentPruner = (SegmentPruner) cls.newInstance();
            segmentPruner.init(segmentPrunerConfig);
            return segmentPruner;
        }
    } catch (Exception ex) {
        throw new RuntimeException("Not support SegmentPruner type with - " + prunerClassName, ex);
    }
    throw new UnsupportedOperationException("No SegmentPruner type with - " + prunerClassName);
}

From source file:ch.citux.td.data.model.TwitchStreamPlayList.java

public static TwitchStreamQuality parseQuality(String name) {
    for (TwitchStreamQuality quality : SUPPORTED_QUALITIES) {
        if (quality.getName().equals(name.toLowerCase())) {
            return quality;
        }/*from  w  w w .  java  2 s  .  co m*/
    }
    return null;
}

From source file:org.opencastproject.remotetest.server.resource.WorkflowResources.java

/**
 * /*from   w  w w .  j a v a 2  s .co  m*/
 * @param id Workflow instance ID
 * @param format Response format: xml or json
 *
 */
public static HttpResponse instance(TrustedHttpClient client, String id, String format) throws Exception {
    return client.execute(new HttpGet(getServiceUrl() + "instance/" + id + format.toLowerCase()));
}

From source file:liveplugin.toolwindow.addplugin.git.jetbrains.plugins.github.util.GithubSslSupport.java

private static void saveToTrusted(@NotNull String host) {
    GithubSettings.getInstance().addTrustedHost(host.toLowerCase());
}