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.appglu.impl.util.StringUtils.java

public static String camelCaseName(String name) {
    if (StringUtils.isEmpty(name)) {
        return name;
    }//w ww .j a va  2s .  c  om

    StringBuilder result = new StringBuilder();

    boolean nextIsUpper = false;

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

    return result.toString();
}

From source file:com.netspective.axiom.schema.BasicSchema.java

public static String translateNameForMapKey(String name) {
    return name.toUpperCase();
}

From source file:com.yonyou.dms.function.utils.common.StringUtils.java

/**
 * ??/*from  www.  j  ava 2  s  . co  m*/
 * 
 * @author zhangxc
 * @date 201677
 * @param obj
 * @param expectValue
 * @return
 */
public static boolean isEqualsNoCasetive(Object obj, String expectValue) {
    if (isNullOrEmpty(obj) || isNullOrEmpty(expectValue)) {
        return false;
    }
    return expectValue.toUpperCase().equals(obj.toString().toUpperCase());
}

From source file:com.lambdasoup.panda.PandaHttp.java

private static String generateSignature(String method, String url, String host, String secretKey,
        Map<String, String> params) {
    String queryString = canonicalQueryString(params);
    String stringToSign = method.toUpperCase() + "\n" + host + "\n" + url + "\n" + queryString;

    String signature = null;//ww w .j  a va 2  s .  c o m

    try {

        SecretKeySpec signingKey = new SecretKeySpec(secretKey.getBytes(), "HmacSHA256");
        Mac mac = Mac.getInstance("HmacSHA256");
        mac.init(signingKey);

        byte[] rawHmac = mac.doFinal(stringToSign.getBytes());

        signature = new String(Base64.encodeBase64(rawHmac));

    } catch (NoSuchAlgorithmException e) {
        e.printStackTrace();
    } catch (InvalidKeyException e) {
        e.printStackTrace();
    }

    return signature;
}

From source file:kirchnerei.glatteis.page.ui.MenuRole.java

public static MenuRole fromString(String role) {
    if (StringUtils.isEmpty(role)) {
        return MENU_PARTIAL;
    }//w  w  w  .j  a  v a  2s .  c om
    if (role.equals("as-partial") || role.equals("partial")) {
        return MENU_PARTIAL;
    } else if (role.equals("as-dialog") || role.equals("dialog")) {
        return MENU_DIALOG;
    }
    try {
        return valueOf(role.toUpperCase());
    } catch (Exception e) {
        return MENU_PARTIAL;
    }
}

From source file:Main.java

public static String byte2hex(byte b[]) {
    String hs = "";
    String stmp = "";
    for (int n = 0; n < b.length; n++) {
        stmp = Integer.toHexString(b[n] & 0xff);
        if (stmp.length() == 1)
            hs = hs + "0" + stmp;
        else/*from  w ww .  ja va 2  s  .co  m*/
            hs = hs + stmp;
        if (n < b.length - 1)
            hs = (new StringBuffer(String.valueOf(hs))).toString();
    }

    return hs.toUpperCase();
}

From source file:com.ziduye.base.web.Servlets.java

/**
 * ??Header.//from   w w  w .  java 2s . com
 * 
 * @param fileName ???.
 */
public static void setFileDownloadHeader(HttpServletRequest request, HttpServletResponse response,
        String fileName) {
    // ???
    String encodedfileName = null;
    // ??firefox??,???+?
    encodedfileName = fileName.trim().replaceAll(" ", "_");
    String agent = request.getHeader("User-Agent");
    boolean isMSIE = (agent != null && agent.toUpperCase().indexOf("MSIE") != -1);
    if (isMSIE) {
        encodedfileName = Encodes.urlEncode(fileName);
    } else {
        encodedfileName = new String(fileName.getBytes(), Charsets.ISO_8859_1);
    }
    response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + encodedfileName + "\"");
}

From source file:com.example.app.support.address.SpellingCorrector.java

/**
 * Attempts to correct possible state mis-spellings
 *
 * @param rawAddress the raw address./* ww w.  java  2s .  c  om*/
 *
 * @return rawAddress or spelling corrected address if a state mis-spelling is found
 */
@SuppressWarnings("OverlyNestedMethod")
public static String correctStateSpelling(String rawAddress) {
    String[] originalTokens = rawAddress.split("\\s+");
    String[] tokens = rawAddress.toUpperCase().split("\\s+");
    int end = tokens.length - 1;
    for (int i = end; i > 0; i--) {
        if (DIGIT.matcher(tokens[i]).matches()) {
            end--;
        } else {
            break; //end is the index of the last non-all-digits token
        }
    }
    if (tokens[end].length() <= 2) { //short word
        return rawAddress; //this almost never works so just skip it
    }
    for (int i = 1; i <= 4; i++) {
        if (end >= i - 1) {
            for (String s : STATE_TOKENS.get(i)) {
                StringBuilder sb = new StringBuilder();
                int newEnd = end - i + 1;
                for (int j = 0; j < i; j++) {
                    sb.append(tokens[newEnd + j]).append(' ');
                }
                float metrics = getNormalizedSimilarity(s, sb.toString().trim());
                if ((int) metrics == 1) {
                    return rawAddress;
                } else if (metrics >= 0.75f) { //assume mis-spelling
                    if (i != 1) {
                        for (int j = 0; j < i - 1; j++) {
                            originalTokens[newEnd + j] = "";
                        }
                    }
                    originalTokens[end] = s;
                    return StringUtils.join(originalTokens, " ");
                }
            }
        }
    }
    return rawAddress;
}

From source file:com.intel.cosbench.driver.service.COSBDriverService.java

private static String generateMissionId() {
    String id = "M" + Integer.toHexString(RandomUtils.nextInt(16));
    id += Integer.toHexString(new Date().hashCode());
    id += Integer.toHexString(RandomUtils.nextInt(16));
    return id.toUpperCase();
}

From source file:com.viettel.ws.client.JDBCUtil.java

public static String UpcaseFirst(String str) {
    String first = str.substring(0, 1);
    String concat = str.substring(1);
    return first.toUpperCase() + concat;
}