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

/**
 * Tries to find Enum of specified name in specified class. If name's null, returns null.
 *
 * @param <E>/* w  w w.jav  a2  s  .  c  o m*/
 * @param clazz
 * @param name
 * @return Parsed object or null
 */
public static <E extends Enum<E>> E findEnum(Class<E> clazz, String name) {
    if (name == null) {
        return null;
    }
    try {
        return Enum.valueOf(clazz, name.toUpperCase());
    } catch (IllegalArgumentException iae) {
        return null;
    }
}

From source file:Main.java

/**
 * @return true if system uses UTF-8 by default
 */// w  w  w .j  a  v  a2s  .c  o m
public static boolean isSystemUtf8() {
    String systemEncoding = getSystemEncoding();
    return (systemEncoding != null && systemEncoding.toUpperCase().equals("UTF-8"));
}

From source file:Main.java

public static byte[] hexStr2Bytes(String hexString) {
    if (hexString == null || hexString.equals("")) {
        return null;
    }//from  ww  w  .  j  a va2 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:com.bitbreeds.webrtc.signaling.CertUtil.java

/**
 *
 * @param fingerPrint sha256 of an encoded cert
 * @return String description of fingerprint formatted 'sha-256 AB:CD...'
 *//*from  w  w  w .j  a v  a2 s. c  o  m*/
public static String createFingerprintString(byte[] fingerPrint) {
    StringBuilder bldr = new StringBuilder();
    bldr.append("sha-256 ");
    for (int i = 0; i < fingerPrint.length; i++) {

        String a = Hex.encodeHexString(new byte[] { fingerPrint[i] });
        bldr.append(a.toUpperCase());
        if (i != fingerPrint.length - 1) {
            bldr.append(":");
        }
    }
    return bldr.toString();
}

From source file:com.esri.geoevent.clusterSimulator.GeoeventClusterSimulator.java

private static ClientServerMode getMode(String string) {
    ClientServerMode mode = ClientServerMode.valueOf(string.toUpperCase());
    return mode;// w w  w  .  j  a  v  a 2s  . c om
}

From source file:Main.java

public static boolean isPicture(String filename) {
    boolean ispicture = false;

    if (filename == null)
        return false;

    filename = filename.toUpperCase();

    if (filename.endsWith(".JPG") || filename.endsWith(".JPEG")) {
        ispicture = true;/*from w w  w .j av  a 2  s  .  co  m*/
    } else if (filename.endsWith(".BMP")) {
        ispicture = true;
    } else if (filename.endsWith(".GIF")) {
        ispicture = true;
    }

    return ispicture;
}

From source file:Main.java

private static int extractConditionsOperatorTokens(String relevant, int startPos, Vector<String> list) {
    int pos, pos2, opSize = 5;

    pos = relevant.toUpperCase().indexOf(" AND ", startPos);
    if (pos < 0) {
        pos = relevant.toUpperCase().indexOf(" OR ", startPos);
        opSize = 4;/*from  w  w  w . j a va 2s.  com*/
    }

    //AND may be the last token when we have starting ORs hence skipping them. eg (relevant="/data/question10=7 OR /data/question6=4    OR  /data/question8=1 AND /data/question1='daniel'")
    pos2 = relevant.toUpperCase().indexOf(" OR ", startPos);
    if (pos2 > 0 && pos2 < pos) {
        pos = pos2;
        opSize = 4;
    }

    if (pos < 0) {
        list.add(relevant.substring(startPos).trim());
        opSize = 0;
    } else
        list.add(relevant.substring(startPos, pos).trim());

    return pos + opSize;
}

From source file:com.almende.pi5.common.ControlMode.java

/**
 * For value.//from   w  w  w  .  ja v  a2s . c  o  m
 *
 * @param value
 *            the value
 * @return the control mode
 */
@JsonCreator
public static ControlMode forValue(final String value) {
    return value == null ? null : valueOf(value.toUpperCase());
}

From source file:net.sf.j2ep.model.AllowedMethodHandler.java

/**
 * Will check if the specified method is allowed by
 * looking if it is included in the allowedMethods.
 * //  www  .  j a  v a 2  s  . c  om
 * @param method The method that is checked
 * @return true if the method is allowed, false otherwise
 */
public static boolean methodAllowed(String method) {
    return allowedMethods.contains(method.toUpperCase());
}

From source file:com.almende.pi5.common.FlexDirection.java

/**
 * For value.// w  w  w . j  a  va2 s . co m
 *
 * @param value
 *            the value
 * @return the flex direction
 */
@JsonCreator
public static FlexDirection forValue(final String value) {
    return value == null ? null : valueOf(value.toUpperCase());
}