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

public static String parseByte2HexStr(byte buf[]) {
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < buf.length; i++) {
        String hex = Integer.toHexString(buf[i] & 0xFF);
        if (hex.length() == 1) {
            hex = '0' + hex;
        }/*from w w w . java2 s . c o  m*/
        sb.append(hex.toUpperCase());
    }
    return sb.toString();
}

From source file:Main.java

private static String parseByte2HexStr(byte buf[]) {
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < buf.length; i++) {
        String hex = Integer.toHexString(buf[i] & 0xFF);
        if (hex.length() == 1) {
            hex = '0' + hex;
        }/*from   w w  w  .  j a v a  2s  .c  om*/
        sb.append(hex.toUpperCase());
    }
    return sb.toString();
}

From source file:Main.java

public static String capitalize(String s) {
    if (s == null)
        return null;
    if (s.length() == 0)
        return s;
    if (s.length() == 1)
        return s.toUpperCase();

    return s.substring(0, 1).toUpperCase() + s.substring(1);
}

From source file:architecture.ee.web.community.social.provider.ServiceProviderHelper.java

public static List<ServiceProviderConfig> getAllServiceProviderConfig() {
    Collection<String> providers = ApplicationHelper.getRepository().getSetupApplicationProperties()
            .getChildrenNames("components.social.providers");
    List<ServiceProviderConfig> infos = new ArrayList<ServiceProviderConfig>(providers.size());
    for (String name : providers) {
        Media media = Media.valueOf(name.toUpperCase());
        infos.add(new ServiceProviderConfig(name, getClientId(media), getClientSecret(media),
                getCallbackUrl(media), getScope(media), allowSignin(media), allowSignup(media)));
    }//from w ww .ja v  a  2 s.c  o  m
    return infos;
}

From source file:Main.java

public static Element fetchSubElement(Element e, String subElementName) {
    if (e == null || subElementName == null) {
        return null;
    }//from  w  ww.  ja  v  a  2 s  .c  o m

    subElementName = subElementName.toUpperCase();

    NodeList list = e.getChildNodes();
    for (int i = 0; i < list.getLength(); i++) {
        if (list.item(i) instanceof Element) {
            Element element = (Element) list.item(i);
            if (element.getTagName().toUpperCase().equals(subElementName)) {
                return element;
            }
        }
    }

    return null;
}

From source file:Main.java

@SuppressWarnings("unused")
private static String parseByte2HexStr(byte buf[]) {
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < buf.length; i++) {
        String hex = Integer.toHexString(buf[i] & 0xFF);
        if (hex.length() == 1) {
            hex = '0' + hex;
        }/*from   ww  w.ja  v  a  2 s .  c  o  m*/
        sb.append(hex.toUpperCase());
    }
    return sb.toString();
}

From source file:Main.java

/**
 * Convert hex string to byte[]/*from w  w w  .j  a v a2 s  . c  o  m*/
 * 
 * @param hexString
 *            the hex string
 * @return byte[]
 */
public static byte[] hexStringToBytes(String hexString) {
    if (hexString == null || hexString.equals("")) {
        return null;
    }
    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:org.icgc.dcc.release.job.id.core.IdJob.java

private static String resolveReleaseName(String releaseName) {
    val idReleaseName = releaseName.toUpperCase().split("-")[0];
    checkState(idReleaseName.matches(RELEASE_NAME_REGEX), "Release name %s does not match regex %s",
            idReleaseName, RELEASE_NAME_REGEX);

    return idReleaseName;
}

From source file:com.synopsys.integration.log.LogLevel.java

public static LogLevel fromString(final String level) {
    if (StringUtils.isNotBlank(level)) {
        try {//from  w  w  w. j  a v  a 2  s.c o m
            return LogLevel.valueOf(level.toUpperCase());
        } catch (final IllegalArgumentException e) {
        }
    }
    return LogLevel.INFO;
}

From source file:Main.java

private static String byte2hex(byte[] bytes) {
    StringBuilder sign = new StringBuilder();
    for (int i = 0; i < bytes.length; i++) {
        String hex = Integer.toHexString(bytes[i] & 0xFF);
        if (hex.length() == 1) {
            sign.append("0");
        }//from ww  w. j a  v  a2  s  .c  om
        sign.append(hex.toUpperCase());
    }
    return sign.toString();
}