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.denimgroup.threadfix.importer.cli.CommandLineMigration.java

private static void convert(String inputScript, String outputScript) {
    File file = new File(inputScript);

    LOGGER.info("Converting threadfix script to mySql script " + outputScript + " ...");

    File outputFile = new File(outputScript);

    FileOutputStream fos = null;// w ww.j a v a 2 s  . co  m
    try {
        fos = new FileOutputStream(outputFile);

        OutputStreamWriter osw = new OutputStreamWriter(fos);

        List<String> lines = FileUtils.readLines(file);

        osw.write("SET FOREIGN_KEY_CHECKS=0;\n");

        String table;
        for (String line : lines) {
            if (line != null && line.toUpperCase().startsWith("CREATE MEMORY TABLE ")) {
                table = RegexUtils.getRegexResult(line, TABLE_PATTERN);
                System.out.println("Create new table:" + table);
                String[] tableName = table.split("\\(", 2);
                if (tableName.length == 2) {
                    List<String> fieldList = list();
                    String[] fields = tableName[1].trim().replace("(", "").replace(")", "").split(",");
                    for (int i = 0; i < fields.length; i++) {
                        if (!"CONSTRAINT".equalsIgnoreCase(fields[i].trim().split(" ")[0])) {
                            String field = fields[i].trim().split(" ")[0].replace("\"", "");
                            if (!fieldList.contains(field))
                                fieldList.add(field);
                        }
                    }
                    String fieldsStr = org.apache.commons.lang3.StringUtils.join(fieldList, ",");
                    tableMap.put(tableName[0].toUpperCase(), "(" + fieldsStr + ")");
                }
            } else if (line != null && line.toUpperCase().startsWith("INSERT INTO ")) {
                table = RegexUtils.getRegexResult(line, INSERT_PATTERN).toUpperCase();
                if (tableMap.get(table) != null) {
                    line = line.replaceFirst(" " + table + " ", " " + table + tableMap.get(table) + " ");
                    if (line.contains(ACUNETIX_ESCAPE)) {
                        line = line.replace(ACUNETIX_ESCAPE, ACUNETIX_ESCAPE_REPLACE);
                    }
                    line = escapeString(line) + ";\n";

                    osw.write(line);
                }
            }
        }
        osw.write("SET FOREIGN_KEY_CHECKS=1;\n");
        osw.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.kylinolap.metadata.tool.HiveSourceTableLoader.java

private static void addColumns(TableDesc sTable, String value) {
    List<ColumnDesc> columns = new ArrayList<ColumnDesc>();
    int i1 = value.indexOf("{");
    int i2 = value.indexOf("}");
    if (i1 < 0 || i2 < 0 || i1 > i2) {
        return;/*from w  w  w. ja va 2  s  .  c  om*/
    }
    String temp = value.substring(i1 + 1, i2);
    String[] strArr = temp.split(", ");
    for (int i = 0; i < strArr.length; i++) {
        String t1 = strArr[i].trim();
        int pos = t1.indexOf(" ");
        String colType = t1.substring(0, pos).trim();
        String colName = t1.substring(pos).trim();
        ColumnDesc cdesc = new ColumnDesc();
        cdesc.setName(colName.toUpperCase());
        cdesc.setDatatype(convertType(colType));
        cdesc.setId(String.valueOf(i + 1));
        columns.add(cdesc);
    }
    sTable.setColumns(columns.toArray(new ColumnDesc[0]));
}

From source file:Main.java

@SuppressLint("DefaultLocale")
public static String byte2hex(byte[] b) {
    String hs = "";
    String stmp = "";
    for (int n = 0; n < b.length; n++) {
        stmp = (Integer.toHexString(b[n] & 0XFF));
        if (stmp.length() == 1) {
            hs = hs + "0" + stmp;
        } else {//from w w  w  . ja v  a 2s . co  m
            hs = hs + stmp;
        }
    }
    return hs.toUpperCase();
}

From source file:com.trenako.values.LocalizedEnum.java

/**
 * Returns the label for the provided {@code enum} value.
 *
 * @param str      the string to be parsed
 * @param enumType the {@code enum} type
 * @return a value if {@code str} is valid constant name
 *//*w  ww.  j  a  v  a  2s .  co  m*/
public static <T extends Enum<T>> LocalizedEnum<T> parseString(String str, MessageSource ms,
        Class<T> enumType) {
    T val = T.valueOf(enumType, str.toUpperCase().replace('-', '_'));
    return new LocalizedEnum<T>(val, ms, null);
}

From source file:th.co.geniustree.dental.spec.ProductSpec.java

public static Specification<Product> unitLike(final String keyword) {
    return new Specification<Product>() {

        @Override//ww  w . ja  v  a 2 s  .com
        public Predicate toPredicate(Root<Product> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.like(cb.upper(root.get(Product_.unit).get(UnitProduct_.name)), keyword.toUpperCase());
        }
    };
}

From source file:com.qmetry.qaf.automation.step.StringTestStep.java

public static void addStep(String name, TestStep step) {
    getStepMapping().put(name.toUpperCase(), step);
}

From source file:Main.java

public static String byte2hex(byte[] b) {
    String hs = "";
    String stmp = "";
    for (int n = 0; n < b.length; n++) {
        stmp = (java.lang.Integer.toHexString(b[n] & 0XFF));
        if (stmp.length() == 1) {
            hs = hs + "0" + stmp;
        } else {/*w  ww.  j av  a2  s  . c o m*/
            hs = hs + stmp;
        }
    }
    return hs.toUpperCase();
}

From source file:com.excelsiorjet.api.util.Utils.java

public static String parameterToEnumConstantName(String parameter) {
    return parameter.toUpperCase().replace('-', '_');
}

From source file:com.salesmanager.core.util.StringUtil.java

public static Map deformatUrlResponse(String payload) throws Exception {
    HashMap nvp = new HashMap();
    StringTokenizer stTok = new StringTokenizer(payload, "&");
    while (stTok.hasMoreTokens()) {
        StringTokenizer stInternalTokenizer = new StringTokenizer(stTok.nextToken(), "=");
        if (stInternalTokenizer.countTokens() == 2) {
            String key = URLDecoder.decode(stInternalTokenizer.nextToken(), "UTF-8");
            String value = URLDecoder.decode(stInternalTokenizer.nextToken(), "UTF-8");
            nvp.put(key.toUpperCase(), value);
        }/*from  www. j a  v  a  2s  .c  o  m*/
    }
    return nvp;
}

From source file:bobs.mcapisignature.CertUtils.java

public static byte[] hexStringToByteArray(String s) {
    s = s.replaceAll(" ", "");
    s = s.replaceAll("-", "");
    s = s.replaceAll(":", "");
    s = s.toUpperCase();
    int len = s.length();
    byte[] data = new byte[len / 2];
    for (int i = 0; i < len; i += 2) {
        data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i + 1), 16));
    }/*w  w w  .ja  v a2s. c o m*/
    return data;
}