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:com.l2jserver.tool.conversor.itemtemplate.ItemTemplateConversor.java

private static String convertValue(String property, String value) {
    if ("material".equals(property))
        return "ItemMaterial." + value.toUpperCase();
    if ("weapon_type".equals(property))
        return "WeaponType." + value.toUpperCase();
    if ("bodypart".equals(property))
        return "InventoryPaperdoll." + value.toUpperCase();
    if ("icon".equals(property))
        return convertString(value);
    if ("damage_range".equals(property))
        return convertArray(value, "int");
    return value;
}

From source file:Main.java

public static UUID getUUID(String uuid) {
    try {//from w  w w  . j a v  a  2 s .c  o  m
        return UUID.fromString(uuid);
    } catch (IllegalArgumentException iae) {
        if (uuid.matches("[0-9a-fA-F]{4}")) {
            return UUID.fromString(String.format(BASE_UUID_FORMAT, uuid.toUpperCase()));
        }
    }
    return null;
}

From source file:com.opengamma.integration.viewer.status.AggregateType.java

public static AggregateType of(String aggregateStrType) {
    ArgumentChecker.notNull(aggregateStrType, "aggregateStrType");

    validateAggregateType(aggregateStrType.toUpperCase());

    List<ViewColumnType> types = Lists.newArrayListWithCapacity(VALID_AGGRAGATION_CHARS.size());
    char[] chars = aggregateStrType.toCharArray();
    for (char character : chars) {
        String shortName = String.valueOf(character);
        ViewColumnType type = ViewColumnType.of(shortName);
        if (type == null) {
            throw new IllegalArgumentException("Unsupported aggregate type: " + shortName);
        }/*from   w  ww . ja v a  2s.  co  m*/
        types.add(type);
    }
    return new AggregateType(types);
}

From source file:Main.java

private static Cipher initCipher(int mode, byte[] key, byte[] iv, String cipherAlgotirhm) {
    try {//from  w  ww.j  a v  a2  s. c o  m
        Key k = toKey(key);
        Cipher cipher = Cipher.getInstance(cipherAlgotirhm);
        String CipherAlgotirhm = cipherAlgotirhm.toUpperCase();
        if (CipherAlgotirhm.contains("CFB") || CipherAlgotirhm.contains("CBC"))
            cipher.init(mode, k, new IvParameterSpec(iv));
        else
            cipher.init(mode, k);
        return cipher;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;

}

From source file:com.aistor.common.servlet.ValidateCodeServlet.java

public static boolean validate(HttpServletRequest request, String validateCode) {
    String code = (String) request.getSession().getAttribute("validateCode");
    return validateCode.toUpperCase().equals(code);
}

From source file:net.certiv.antlr.project.util.Strings.java

public static String initialUC(String str) {
    if (str == null)
        return "";
    if (str.length() < 2)
        return str.toUpperCase();
    return str.substring(0, 1).toUpperCase() + str.substring(1);
}

From source file:ImageIOTest.java

/**
 * Gets a set of "preferred" format names of all image writers. The preferred format name is the
 * first format name that a writer specifies.
 * @return the format name set//from   w  ww.  ja va  2s  . c  o m
 */
public static Set<String> getWriterFormats() {
    TreeSet<String> writerFormats = new TreeSet<String>();
    TreeSet<String> formatNames = new TreeSet<String>(Arrays.asList(ImageIO.getWriterFormatNames()));
    while (formatNames.size() > 0) {
        String name = formatNames.iterator().next();
        Iterator<ImageWriter> iter = ImageIO.getImageWritersByFormatName(name);
        ImageWriter writer = iter.next();
        String[] names = writer.getOriginatingProvider().getFormatNames();
        String format = names[0];
        if (format.equals(format.toLowerCase()))
            format = format.toUpperCase();
        writerFormats.add(format);
        formatNames.removeAll(Arrays.asList(names));
    }
    return writerFormats;
}

From source file:Main.java

public static byte[] hexStringToBytes(String hexString) {
    if (hexString.length() % 2 != 0)
        throw new IllegalArgumentException("Hex string length must be even: " + hexString);
    byte[] bytes = new byte[hexString.length() / 2];
    char[] ucChars = hexString.toUpperCase().toCharArray();
    for (int i = 0; i < bytes.length; i++) {
        int index1 = HEX_CHARS_STRING.indexOf(ucChars[2 * i]);
        int index2 = HEX_CHARS_STRING.indexOf(ucChars[2 * i + 1]);
        if (index1 == -1 || index2 == -1)
            throw new IllegalArgumentException("Non-hex character in string: " + hexString);
        bytes[i] = (byte) ((index1 << 4) + index2);
    }/* ww w  .  jav a  2  s  . c o m*/
    return bytes;
}

From source file:com.paladin.common.LuceneHelper.java

/**
 * ?/*from www .  j  a v a2s . c o m*/
 * //TODO:???
 *
 * @param writer
 * @param table
 */
private static void indexTable(IndexWriter writer, String table) throws IOException {
    String sql = "SELECT ID, TITLE, CONTENT, TAG, CREATE_DATE FROM " + table.toUpperCase();

    if (table.equalsIgnoreCase("motto"))
        sql = "SELECT ID, CONTENT, TAG, CREATE_DATE FROM " + table.toUpperCase();

    List<Map<String, Object>> blogs = QueryHelper.queryList(sql);

    for (Map<String, Object> blog : blogs) {
        Document doc = new Document();
        Field id_field = new Field("id", blog.get("ID").toString(), Field.Store.YES,
                Field.Index.NOT_ANALYZED_NO_NORMS);
        // ?
        StringBuilder builder = new StringBuilder();

        if (table.equalsIgnoreCase("motto"))
            builder.append(blog.get("CONTENT"));
        else
            builder.append(blog.get("TITLE"));
        builder.append(Constants.LUCENE_FIELD_SEP);
        builder.append(blog.get("CONTENT"));
        builder.append(Constants.LUCENE_FIELD_SEP);
        builder.append(blog.get("TAG"));

        Field t_c_t_field = new Field("title_content_tag", builder.toString(), Field.Store.YES,
                Field.Index.ANALYZED);

        doc.add(id_field);
        doc.add(t_c_t_field);

        if (writer.getConfig().getOpenMode() == IndexWriterConfig.OpenMode.CREATE)
            writer.addDocument(doc);
        else// id??
            writer.updateDocument(new Term("id", blog.get("ID").toString()), doc);
    }
}

From source file:apm.common.servlet.ValidateCodeServlet.java

public static boolean validate(HttpServletRequest request, String validateCode) {
    String code = (String) request.getSession().getAttribute(VALIDATE_CODE);
    return validateCode.toUpperCase().equals(code);
}