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 boolean isNumeric(String operand) {
    operand = operand.toUpperCase();
    if (operand.contains("0X")) {
        return operand.matches("0[xX][0-9a-fA-F]+");
    }/* w ww .j  a v a 2  s. co m*/
    if (operand.contains("H")) {
        return operand.matches("\\d+[h|H]+");
    }

    return operand.matches("\\d+");

}

From source file:Main.java

public static int hexStringToAlgorism(String hex) {
    hex = hex.toUpperCase();
    int max = hex.length();
    int result = 0;
    for (int i = max; i > 0; i--) {
        char c = hex.charAt(i - 1);
        int algorism = 0;
        if (c >= '0' && c <= '9') {
            algorism = c - '0';
        } else {//from   w  w w  .  ja  va  2s  .co m
            algorism = c - 55;
        }
        result += Math.pow(16, max - i) * algorism;
    }
    return result;
}

From source file:Main.java

public static int hex2dec(String hexValue) {
    hexValue = hexValue.toUpperCase();
    int decimalResult = 0;

    for (int i = 0; i < hexValue.length(); i++) {
        char digit = hexValue.charAt(i);
        int digitValue = HEX_CHARACTERS.indexOf(digit);
        decimalResult = decimalResult * 16 + digitValue;
    }//  ww w  .ja v a 2  s. c o  m
    return decimalResult;
}

From source file:Main.java

public static boolean isZip(String s) {
    if (s.contains(".")) {
        String[] r = s.split("\\.");
        String ext = r[r.length - 1];
        if (ext.toUpperCase().equals("ZIP")) {
            return true;
        }/* w w w  .  j a v a 2s. co  m*/
    }
    return false;
}

From source file:Main.java

/**
 * Checks if the function is supported//from   ww  w.j  a v a 2s  .c o m
 * @param func function in String format
 * @return
 */
public static boolean isValidAgrFunction(String func) {
    String upperFunc = func.toUpperCase();
    for (String agrFunc : SUPPORTED_FUNCS) {
        if (upperFunc.equals(agrFunc))
            return true;
    }
    return false;
}

From source file:com.hpcloud.mon.common.model.alarm.AlarmState.java

@JsonCreator
public static AlarmState fromJson(String text) {
    return valueOf(text.toUpperCase());
}

From source file:com.hpcloud.mon.domain.model.notificationmethod.NotificationMethodType.java

@JsonCreator
public static NotificationMethodType fromJson(String text) {
    return valueOf(text.toUpperCase());
}

From source file:org.mayocat.model.AddonSource.java

@JsonCreator
public static AddonSource fromJson(String text) {
    return valueOf(text.toUpperCase());
}

From source file:org.mayocat.shop.shipping.Strategy.java

@JsonCreator
public static Strategy fromJson(String text) {
    return valueOf(text.toUpperCase());
}

From source file:Main.java

public static String firstCapitalize(String txt) {
    if (txt.isEmpty())
        return "";
    int length = txt.length();
    String first = txt.substring(0, 1);
    first = first.toUpperCase();
    String capitalize = first + txt.substring(1, length);
    return capitalize;
}