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

@SuppressLint("DefaultLocale")
public static String byteToHexString(byte[] b) {
    StringBuffer hexString = new StringBuffer();
    for (int i = 0; i < b.length; i++) {
        String hex = Integer.toHexString(b[i] & 0xFF);
        if (hex.length() == 1) {
            hex = '0' + hex;
        }// w w  w  .  j a  va 2s.c o m
        hexString.append(hex.toUpperCase());
    }
    return hexString.toString();
}

From source file:Main.java

public static byte[] hexStringToBytes(String hexString) {
    if (hexString == null || hexString.equals("")) {
        return null;
    }//w w  w  .  j a v a  2 s  . c  o m
    hexString = hexString.toUpperCase();
    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:de.estudent.nfc.NFCHelper.java

public static String encodeToHexString(byte b) {
    byte[] array = new byte[1];
    array[0] = b;/* w w  w  .j a  va  2  s . c  o  m*/
    String result = new String(Hex.encodeHex(array));
    result = "0x" + result.toUpperCase();
    return result;
}

From source file:kirchnerei.glatteis.page.RequestKind.java

public static RequestKind fromString(String name) {
    if (StringUtils.isEmpty(name)) {
        return UNKNOWN;
    }/*  w  w w  .  j a va 2 s  .c o m*/
    try {
        return valueOf(name.toUpperCase());
    } catch (Exception e) {
        return UNKNOWN;
    }
}

From source file:org.commonjava.indy.subsys.http.util.UserPass.java

public static UserPass parse(final ApplicationHeader header, final HttpRequest httpRequest, String userpass) {
    Logger logger = LoggerFactory.getLogger(UserPass.class);
    if (userpass == null) {
        Header[] headers = httpRequest.getHeaders(header.key());
        if (headers != null && headers.length > 0) {
            for (Header h : headers) {
                String value = h.getValue();
                if (value.toUpperCase().startsWith("BASIC ")) {
                    final String[] authParts = value.split(" ");
                    userpass = new String(Base64.decodeBase64(authParts[1]));
                    logger.info("userpass is: '{}'", userpass);
                    break;
                }/* www  .j  a  va2s  .c o  m*/
            }
        }
    }

    if (userpass != null) {
        final String[] upStr = userpass.split(":");
        logger.info("Split userpass into:\n  {}", StringUtils.join(upStr, "\n  "));

        if (upStr.length < 1) {
            return null;
        }

        return new UserPass(upStr[0], upStr.length > 1 ? upStr[1] : null);
    }

    return null;
}

From source file:Main.java

static public <T> T getFieldValue(Object obj, String fieldName) {
    String first = fieldName.substring(0, 1);
    String remain = fieldName.substring(1);

    return callMethodWithNoArgs(obj, String.format("get%s%s", first.toUpperCase(), remain));
}

From source file:de.tudarmstadt.ukp.csniper.webapp.evaluation.model.Mark.java

public static Mark fromString(String aTitle) {
    if (StringUtils.isBlank(aTitle)) {
        return NA;
    } else {/*from  w ww.  ja  va  2  s.  c  o  m*/
        return valueOf(aTitle.toUpperCase());
    }
}

From source file:Main.java

private static String byte2hex(byte[] bytes) {
    StringBuilder sign = new StringBuilder();
    for (byte data : bytes) {
        String hex = Integer.toHexString(data & 0xFF);
        if (hex.length() == 1) {
            sign.append("0");
        }//ww w . ja v  a2  s.  c  o m
        sign.append(hex.toUpperCase());
    }
    return sign.toString();
}

From source file:com.streamsets.pipeline.stage.util.http.HttpStageTestUtil.java

@NotNull
public static String randomizeCapitalization(Random random, String input) {
    StringBuilder header = new StringBuilder();
    for (int i = 0; i < input.length(); i++) {
        String nextChar = input.substring(i, i + 1);
        if (random.nextBoolean()) {
            header.append(nextChar.toUpperCase());
        } else {//  w  w w.j a v  a  2  s  .co m
            header.append(nextChar.toLowerCase());
        }
    }
    return header.toString();
}

From source file:com.wavemaker.app.build.pages.Page.java

public static Page getPage(String pageName) {
    return (StringUtils.isNotBlank(pageName) ? Page.valueOf(pageName.toUpperCase()) : null);
}