Example usage for java.lang String toUpperCase

List of usage examples for java.lang String toUpperCase

Introduction

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

Prototype

public String toUpperCase() 

Source Link

Document

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

Usage

From source file:Main.java

/**
 * Checks if String contains a search String irrespective of case,
 * handling <code>null</code>. This method uses
 * {@link #contains(String, String)}.//w w  w .  j  av a 2  s  . c om
 *
 * A <code>null</code> String will return <code>false</code>.
 *
 * <pre>
 * StringUtils.contains(null, *) = false
 * StringUtils.contains(*, null) = false
 * StringUtils.contains("", "") = true
 * StringUtils.contains("abc", "") = true
 * StringUtils.contains("abc", "a") = true
 * StringUtils.contains("abc", "z") = false
 * StringUtils.contains("abc", "A") = true
 * StringUtils.contains("abc", "Z") = false
 * </pre>
 *
 * @param str  the String to check, may be null
 * @param searchStr  the String to find, may be null
 * @return true if the String contains the search String irrespective of
 * case or false if not or <code>null</code> string input
 */
public static boolean containsIgnoreCase(String str, String searchStr) {
    if (str == null || searchStr == null) {
        return false;
    }
    return contains(str.toUpperCase(), searchStr.toUpperCase());
}

From source file:com.aliyun.openservices.odps.console.pub.StopInstanceCommand.java

public static StopInstanceCommand parse(String commandString, ExecutionContext sessionContext)
        throws ODPSConsoleException {
    if (commandString.toUpperCase().startsWith("KILL")) {

        String temp[] = commandString.trim().replaceAll("\\s+", " ").split(" ");

        CommandLine cl = getCommandLine(temp);

        if (2 == cl.getArgs().length) {
            return new StopInstanceCommand(commandString, sessionContext, temp[1], false);
        }//from  w w  w  . j  av a2 s.  c om

        if (1 != cl.getArgs().length) {
            throw new ODPSConsoleException(ODPSConsoleConstants.BAD_COMMAND + "[invalid parameters]");
        }

        if (cl.hasOption("sync")) {
            return new StopInstanceCommand(commandString, sessionContext, cl.getOptionValue("sync"), true);
        }
    }

    return null;
}

From source file:mx.com.pendulum.carga.util.Md5Converter.java

private static String convertHashToString(byte[] md5Bytes) {
    String returnVal = "";
    for (int i = 0; i < md5Bytes.length; i++) {
        returnVal += Integer.toString((md5Bytes[i] & 0xff) + 0x100, 16).substring(1);
    }//from ww w.  j av  a  2s .c om
    return returnVal.toUpperCase();
}

From source file:com.denimgroup.threadfix.importer.cli.CommandLineMigration.java

private static String escapeString(String line) {

    if (line.toUpperCase().contains("INSERT INTO APPLICATION(")
            || line.toUpperCase().contains("INSERT INTO DEFAULTCONFIGURATION(")
            || line.toUpperCase().contains("INSERT INTO USER(")
            || line.toUpperCase().contains("INSERT INTO FINDING(")) {
        line = StringEscapeUtils.unescapeUnicode(line);
    }//from w  w  w .j  a va2  s  .co  m

    if (line.toUpperCase().contains("INSERT INTO FINDING")) {
        //Double backslash for multi backslash group
        line = line.replaceAll("(\\\\[\\\\]+)", "$1$1");
        // Double for single backslash
        line = line.replaceAll("([^\\\\])(\\\\[^nrt\\\\])", "$1\\\\$2");
    }

    return line;
}

From source file:it.polimi.geinterface.DAO.Entity.java

public static String getBeaconNameFromUuid(String beaconId) {

    switch (beaconId.toUpperCase()) {

    case "B9407F30-F5F8-466E-AFF9-25556B57FE6D:42730:37336":
        return "Ice Beacon";

    case "B9407F30-F5F8-466E-AFF9-25556B57FE6D:34061:44153":
        return "Blueberry Beacon";

    case "B9407F30-F5F8-466E-AFF9-25556B57FE6D:48147:52400":
        return "Mint Beacon";

    default://from  w w w . j a  v a2s. c  o m
        return beaconId;
    }
}

From source file:com.appglu.impl.util.StringUtils.java

public static String underscoreName(String name) {
    if (StringUtils.isEmpty(name)) {
        return name;
    }// ww  w .  j  a  v  a2 s.c o m

    StringBuilder result = new StringBuilder();
    result.append(name.substring(0, 1).toLowerCase());

    for (int i = 1; i < name.length(); i++) {
        String s = name.substring(i, i + 1);
        if (s.equals(s.toUpperCase())) {
            result.append("_");
            result.append(s.toLowerCase());
        } else {
            result.append(s);
        }
    }

    return result.toString();
}

From source file:lucee.commons.io.res.type.smb.SMBResourceProvider.java

public static String unencryptUserInfo(String userInfo) {
    if (!isEncryptedUserInfo(userInfo))
        return userInfo;
    String encrypted = userInfo.replaceAll(Pattern.quote(ENCRYPTED_PREFIX), "");
    byte[] unencryptedBytes = Base32DecEnc.decode(encrypted.toUpperCase());
    return new String(unencryptedBytes, UTF8);

}

From source file:it.geosolutions.geobatch.opensdi.csvingest.utils.CSVIngestUtils.java

/**
 * Obtain DecMonth for a string//  w w  w.  j  av a 2s . co  m
 * 
 * @param month short name of the month (like Nov, NOV or nov for November)
 * @return DecMonth
 * @throws CSVProcessException if <code>month</code> it's a unrecognized string
 *         or null
 */
public static DecMonth getDecMonth(String month) throws CSVProcessException {
    if (month != null) {
        // Obtain DecMonth for a string
        String monthUpper = month.toUpperCase();
        for (DecMonth dec : DecMonth.values()) {
            if (dec.name().equals(monthUpper)) {
                return dec;
            }
        }
    }
    // Incorrect moth
    throw new CSVProcessException("Incorrect month=" + month);
}

From source file:Main.java

public static boolean checkGpgga(String checkString) {
    if (!checkString.contains("*"))
        return false;
    if (checkString.indexOf("*") + 4 > checkString.length())
        return false;
    String checkMain = checkString.substring(checkString.indexOf("*") + 1, checkString.indexOf("*") + 3);
    String bufferString = getCheckNum(checkString);
    if (checkMain == null || bufferString == null)
        return false;
    return checkMain.toUpperCase().equals(bufferString.toUpperCase());
}

From source file:com.tinypace.mobistore.util.StringUtil.java

public static String GetUuid() {
    UUID uuid = UUID.randomUUID();
    String str = uuid.toString();
    str = str.replace("-", "");
    return str.toUpperCase();
}