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:com.example.aliyundemo.ocr.util.SignUtil.java

/**
 * ??//from  ww  w.j  a v  a  2 s  .  c  o m
 *
 * @param headers              Http
 * @param url                  Path+Query
 * @param formParamMap         POST??
 * @param method
 * @param signHeaderPrefixList ???Header?
 * @return ??
 */
private static String buildStringToSign(Map<String, String> headers, String url, Map formParamMap,
        String method, List<String> signHeaderPrefixList) {
    StringBuilder sb = new StringBuilder();

    sb.append(method.toUpperCase()).append(Constants.LF);
    if (headers.get(HttpHeader.HTTP_HEADER_ACCEPT) != null) {
        sb.append(headers.get(HttpHeader.HTTP_HEADER_ACCEPT));
    }
    sb.append(Constants.LF);
    if (headers.get(HttpHeader.HTTP_HEADER_CONTENT_MD5) != null) {
        sb.append(headers.get(HttpHeader.HTTP_HEADER_CONTENT_MD5));
    }
    sb.append(Constants.LF);
    if (headers.get(HttpHeader.HTTP_HEADER_CONTENT_TYPE) != null) {
        sb.append(headers.get(HttpHeader.HTTP_HEADER_CONTENT_TYPE));
    }
    sb.append(Constants.LF);
    if (headers.get(HttpHeader.HTTP_HEADER_DATE) != null) {
        sb.append(headers.get(HttpHeader.HTTP_HEADER_DATE));
    }
    sb.append(Constants.LF);
    sb.append(buildHeaders(headers, signHeaderPrefixList));
    sb.append(buildResource(url, formParamMap));

    return sb.toString();
}

From source file:com.glaf.core.xml.XmlProperties.java

public static JSONObject getJSONObject(String key) {
    if (hasObject(key)) {
        String value = properties.getProperty(key);
        if (value == null) {
            value = properties.getProperty(key.toUpperCase());
        }/*from   w  ww.  ja v  a  2  s.  co m*/
        return JSON.parseObject(value);
    }
    return null;
}

From source file:de.micromata.genome.gwiki.utils.ClassUtils.java

public static String getSetter(String propName) {
    if (StringUtils.isEmpty(propName) == true) {
        return null;
    }//from w w  w  .  java 2 s .c om
    if (propName.length() == 1) {
        return "set" + propName.toUpperCase();
    }
    return "set" + propName.substring(0, 1).toUpperCase() + propName.substring(1);
}

From source file:de.micromata.genome.gwiki.utils.ClassUtils.java

public static String getGetter(String propName) {
    if (StringUtils.isEmpty(propName) == true) {
        return null;
    }/*w  w  w  .  ja v  a  2s. c  o m*/
    if (propName.length() == 1) {
        return "get" + propName.toUpperCase();
    }
    return "get" + propName.substring(0, 1).toUpperCase() + propName.substring(1);
}

From source file:com.ibm.rpe.web.service.docgen.impl.TemplateBuilderImpl.java

private static String downloadFile(String path) throws Exception {
    String data = null;/*from w w  w  . j a  va  2 s  .  co m*/

    if (path != null) {

        if (path.toUpperCase().startsWith("FILE:") || (new File(path)).exists()) {
            data = IOUtils.toString(new FileInputStream(path), "UTF-8");
        } else if (path.toUpperCase().startsWith("HTTP")) {
            Client client = new Client();

            ClientResponse response = client.resource(UriBuilder.fromUri(path).build())
                    .get(ClientResponse.class);

            if (Response.Status.OK.getStatusCode() == response.getStatus()) {
                data = response.getEntity(String.class);
            } else {
                throw new Exception("Error while getting data");
            }
        }
    }

    return data;
}

From source file:Main.java

public static String byte2hex(byte[] b) {
    String hs = "";
    String stmp = "";

    for (int n = 0; n < b.length; n++) {
        stmp = (java.lang.Integer.toHexString(b[n] & 0XFF));
        if (stmp.length() == 1)
            hs = hs + "0" + stmp;
        else/*from www  .  j  av a  2  s  . c  om*/
            hs = hs + stmp;
        // if (n<b.length-1) hs=hs;
    }
    return hs.toUpperCase();
}

From source file:com.clustercontrol.systemlog.bean.SyslogMessage.java

/**
 * ??/*from  ww  w  .  j  a  va2s .  c  o m*/
 * ?(String)Calendar?(int)???
 * 
 * @param month 
 * @return Calendar?
 */
private static int editCalendarMonth(String month) {

    switch (month.toUpperCase()) {
    case "JAN":
        return Calendar.JANUARY;
    case "FEB":
        return Calendar.FEBRUARY;
    case "MAR":
        return Calendar.MARCH;
    case "APR":
        return Calendar.APRIL;
    case "MAY":
        return Calendar.MAY;
    case "JUN":
        return Calendar.JUNE;
    case "JUL":
        return Calendar.JULY;
    case "AUG":
        return Calendar.AUGUST;
    case "SEP":
        return Calendar.SEPTEMBER;
    case "OCT":
        return Calendar.OCTOBER;
    case "NOV":
        return Calendar.NOVEMBER;
    case "DEC":
        return Calendar.DECEMBER;
    }
    return Calendar.UNDECIMBER;
}

From source file:com.github.riking.dropcontrol.ItemStringInterpreter.java

public static BasicItemMatcher valueOf(String itemString) throws IllegalArgumentException {
    itemString = itemString.toUpperCase();
    if (itemString.equals("ANY")) {
        return new BasicItemMatcher(null, null, null);
    }//  ww w . j  a  va 2  s . co  m
    String[] split = itemString.split(":");
    Validate.isTrue(split.length <= 2,
            "Unable to parse item string - too many colons (maximum 1). Please correct the format and reload the config. Input: "
                    + itemString);
    Material mat = getMaterial(split[0]);
    Validate.notNull(mat,
            "Unable to parse item string - unrecognized material. Please correct the format and reload the config. Input: "
                    + itemString);
    if (split.length == 1) {
        return new BasicItemMatcher(mat, null, null);
    }
    String dataString = split[1];
    short data;
    try {
        data = Short.parseShort(dataString);
        return new BasicItemMatcher(mat, data, null); // the datastring is not passed if it was just a number
    } catch (NumberFormatException ignored) {
    }
    if (materialData.containsKey(mat.getData())) {
        Class<? extends MaterialData> matClass = mat.getData();
        Class<? extends Enum> enumClass = materialData.get(mat.getData());
        Enum enumValue;
        try {
            enumValue = (Enum) enumClass.getMethod("valueOf", String.class).invoke(null, dataString);
        } catch (InvocationTargetException e) {
            throw new IllegalArgumentException("Unable to parse item string - " + dataString
                    + " is not a valid member of " + enumClass.getSimpleName(), e.getCause());
        } catch (Exception rethrow) {
            throw new RuntimeException("Unexpected exception when parsing item string", rethrow);
        }
        MaterialData matData;
        try {
            matData = matClass.getConstructor(enumClass).newInstance(enumValue);
        } catch (Exception rethrow) {
            throw new RuntimeException("Unexpected exception when parsing item string", rethrow);
        }
        data = (short) matData.getData();
        return new BasicItemMatcher(mat, data, dataString);
    }
    if (workarounds.containsKey(mat)) {
        StringInterpreter interp = workarounds.get(mat);
        data = interp.interpret(dataString);
        return new BasicItemMatcher(mat, data, dataString);
    }
    throw new IllegalArgumentException(
            "Unable to parse item string - I don't know how to parse a word-data for " + mat);
}

From source file:com.kstenschke.shifter.utils.UtilsTextual.java

/**
 * @param   str         String to be checked
 * @return  boolean     Is the given string fully lower case?
 *//*from ww w.  ja  v a 2  s  .  co m*/
public static boolean isAllUppercase(String str) {
    return str.equals(str.toUpperCase());
}

From source file:com.vake.ArrayUtils.java

/**
 * ??????XX?<p/>/*  w  w w . j a v a2  s  .c  o  m*/
 * bytesnull"null"bytes""
 *
 * @param bytes 
 * @return ?
 */
public static String toSimpleHexString(byte[] bytes) {
    if (null == bytes) {
        return "null";
    }

    final int len = bytes.length;
    final StringBuilder builder = new StringBuilder(len * 2);
    for (int i = 0; i < len; i++) {
        final int intValue = bytes[i] & 0xFF;
        final String string = Integer.toHexString(intValue);
        final String padString = StringUtils.leftPad(string, 2, '0');
        builder.append(padString.toUpperCase());
    }
    return builder.toString();
}