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(Locale locale) 

Source Link

Document

Converts all of the characters in this String to upper case using the rules of the given Locale .

Usage

From source file:Main.java

public static byte[] hexStringToBytes(String hexString) {
    if (hexString == null || hexString.equals("")) {
        return null;
    }//from  w  w w.j  a v a2s . c  om
    hexString = hexString.toUpperCase(Locale.getDefault());
    int length = hexString.length() / 2;
    char[] hexChars = hexString.toCharArray();
    byte[] d = new byte[length];
    for (int i = 0; i < length; i++) {
        int pos = i * 2;
        d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
    }
    return d;
}

From source file:Main.java

public static String bytesToHexString(byte[] src) {
    if (src == null || src.length <= 0) {
        return null;
    }/*from  www  . ja  v a2 s .  c  om*/
    String hexStr = "";
    for (byte b : src) {
        String hex = Integer.toHexString(b & 0xFF);
        if (hex.length() == 1) {
            hex = '0' + hex;
        }
        hexStr += hex.toUpperCase(Locale.getDefault());
    }
    return hexStr;
}

From source file:Main.java

private static String UpperCase(String str) {
    int len = str.length();
    String result = "";
    for (int i = 0; i < len; i++) {
        String subStr = str.substring(i, i + 1);
        char subChar = str.charAt(i);
        if (subChar >= 'a' && subChar <= 'z')
            result += subStr.toUpperCase(Locale.US);
        else//  w  ww .jav  a2 s.c  om
            result += subStr;
    }
    return result;
}

From source file:com.wealdtech.utils.EnvironmentType.java

@JsonCreator
public static EnvironmentType fromString(final String type) {
    checkNotNull(type, "Environment type is required");
    try {/*ww w . jav  a2 s  . c  om*/
        return valueOf(type.toUpperCase(Locale.ENGLISH));
    } catch (IllegalArgumentException iae) {
        // N.B. we don't pass the iae as the cause of this exception because this happens during invocation, and in that case the
        // enum handler will report the root cause exception rather than the one we throw.
        throw new DataError.Bad("An environment type supplied is invalid");
    }
}

From source file:Main.java

public static final String bytesToHexString(byte[] bArray) {
    StringBuffer sb = new StringBuffer(bArray.length);

    for (int i = 0; i < bArray.length; i++) {
        String sTemp = Integer.toHexString(0xFF & bArray[i]);
        if (sTemp.length() < 2) {
            sb.append(0);/*from w  ww  .j av a 2 s.c o  m*/
        }
        sb.append(sTemp.toUpperCase(Locale.US));
    }
    return sb.toString();
}

From source file:Main.java

public static String toMatchString(List<String> terms) {
    StringBuilder builder = new StringBuilder();
    for (String term : terms) {
        if (builder.length() != 0) {
            builder.append(' ');
        }//w  w w. j a v a2s  .c  o m
        if (isKeyword(term)) {
            builder.append(term.toUpperCase(Locale.ENGLISH));
        } else if (term.contains("*") || term.startsWith("-")) {
            builder.append(term);
        } else {
            builder.append('*').append(term).append('*');
        }
    }
    return builder.toString();
}

From source file:by.stub.utils.StringUtils.java

public static String toUpper(final String toUpper) {
    if (!isSet(toUpper)) {
        return null;
    }/*from ww  w.ja va2s .c  om*/
    return toUpper.toUpperCase(Locale.US);
}

From source file:at.ac.univie.isc.asio.security.Role.java

private static String normalize(final String name) {
    if (name.startsWith(PREFIX)) {
        return name.substring(PREFIX.length()).toUpperCase(Locale.ENGLISH);
    } else {/*from w w  w.  j  av  a 2 s .co  m*/
        return name.toUpperCase(Locale.ENGLISH);
    }
}

From source file:com.asual.summer.core.RequestFilter.java

static String getMethod(HttpServletRequest request, String requestMethod) {
    String method = request.getParameter(methodAttribute);
    if ("POST".equalsIgnoreCase(requestMethod) && !StringUtils.isEmpty(method)) {
        return method.toUpperCase(Locale.ENGLISH);
    }/*from  www . ja v a  2  s .co m*/
    return requestMethod;
}

From source file:net.eledge.android.toolkit.db.internal.FieldType.java

public static FieldType getType(Class<?> clazz) {
    if (clazz.isEnum()) {
        return ENUM;
    }//from  www  .  j  a  v  a  2s .com
    String type = clazz.getSimpleName();
    if ("int".equals(type)) {
        return INTEGER;
    }
    return valueOf(type.toUpperCase(Locale.ENGLISH));
}