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:th.co.geniustree.intenship.advisor.spec.TimetableSpec.java

public static Specification<Timetable> nameLike(final String keyword) {
    return new Specification() {
        @Override/*from   w  ww  .  j a  v a 2s  .  com*/
        public Predicate toPredicate(Root root, CriteriaQuery cq, CriteriaBuilder cb) {
            return cb.like(cb.upper(root.get(Timetable_.account).get(Account_.name)), keyword.toUpperCase());
        }
    };
}

From source file:th.co.geniustree.intenship.advisor.spec.TimetableSpec.java

public static Specification<Timetable> nameTeacherLike(final String keyword) {
    return new Specification() {
        @Override//from   www .j  av a  2s. c om
        public Predicate toPredicate(Root root, CriteriaQuery cq, CriteriaBuilder cb) {
            return cb.like(cb.upper(root.get(Timetable_.account).get(Account_.name)), keyword.toUpperCase());
        }
    };
}

From source file:gov.usgs.cida.glri.sb.ui.GLRIUtil.java

/**
 * Parses an http contentType header string into the encoding, if it exists.
 * If it cannot find the encoding, the default is returned.
 * /*from  w  w w  .  j  a  va  2 s  . c  o  m*/
 * @param contentTypeHeaderString The String value of the http contentType header
 * @param defaultEncoding Return this encoding if we cannot find the value in the header.
 * @return encoding
 */
public static String findEncoding(String contentTypeHeaderString, String defaultEncoding) {

    try {
        //Example contentType:  text/html; charset=utf-8

        String[] parts = contentTypeHeaderString.split(";");
        String encoding = StringUtils.trimToNull(parts[1]);
        parts = encoding.split("=");

        if (parts[0].trim().equalsIgnoreCase("charset")) {
            encoding = StringUtils.trimToNull(parts[1]);
            return encoding.toUpperCase();
        } else {
            return defaultEncoding;
        }

    } catch (RuntimeException e) {
        return defaultEncoding;
    }
}

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

public static Specification<Employee> nameLike(final String keyword) {
    return new Specification<Employee>() {

        @Override/*  www  . j  a v a  2 s. co  m*/
        public Predicate toPredicate(Root<Employee> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {

            return cb.like(cb.upper(root.get(Employee_.nameTh)), keyword.toUpperCase());
        }
    };
}

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

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

        @Override/*from  ww w.  j  a v a2s. c om*/
        public Predicate toPredicate(Root<Product> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.like(cb.upper(root.get(Product_.name)), keyword.toUpperCase());
        }
    };
}

From source file:com.evolveum.midpoint.testing.model.client.sample.Upload.java

private static void uploadDir(String dirname, CommandLine cmdline, ModelPortType modelPort) {
    File[] files = new File(dirname).listFiles(new FilenameFilter() {
        @Override//from   ww w  .j  a  va  2  s . c o m
        public boolean accept(File dir, String name) {
            return name.toUpperCase().endsWith(".XML");
        }
    });
    for (File file : files) {
        uploadFile(file, cmdline, modelPort);
    }
}

From source file:th.co.geniustree.intenship.advisor.spec.InformationSpec.java

public static Specification<Information> titleLike(final String keyword) {
    return new Specification<Information>() {

        @Override/*w w w  .  ja  v  a2 s.c o m*/
        public Predicate toPredicate(Root<Information> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.like(cb.upper(root.get(Information_.title)), keyword.toUpperCase());
        }
    };
}

From source file:io.hops.experiments.stats.TransactionStatsAggregator.java

public static Map<String, DescriptiveStatistics> aggregate(File statsFile, String headerPattern,
        String transaction, boolean printSummary) throws IOException {
    if (!statsFile.exists())
        return null;

    transaction = transaction.toUpperCase();

    BufferedReader reader = new BufferedReader(new FileReader(statsFile));
    String tx = reader.readLine();
    String[] headers = null;/*ww  w  .  j av  a  2  s.com*/
    Map<Integer, DescriptiveStatistics> statistics = Maps.newHashMap();
    if (tx != null) {
        headers = tx.split(",");
        for (int i = 1; i < headers.length; i++) {
            String h = headers[i].toUpperCase();
            if (h.contains(headerPattern) || headerPattern.equals(ALL)) {
                statistics.put(i, new DescriptiveStatistics());
            }
        }
    }

    int txCount = 0;
    while ((tx = reader.readLine()) != null) {
        if (tx.startsWith(transaction) || transaction.equals(ALL)) {
            txCount++;
            String[] txStats = tx.split(",");
            if (txStats.length == headers.length) {
                for (Map.Entry<Integer, DescriptiveStatistics> e : statistics.entrySet()) {
                    e.getValue().addValue(Double.valueOf(txStats[e.getKey()]));
                }
            }
        }
    }

    reader.close();

    if (headers == null)
        return null;

    if (printSummary) {
        System.out.println("Transaction: " + transaction + " " + txCount);

        List<Integer> keys = new ArrayList<Integer>(statistics.keySet());
        Collections.sort(keys);

        for (Integer i : keys) {
            DescriptiveStatistics stats = statistics.get(i);
            if (stats.getMin() == 0 && stats.getMax() == 0) {
                continue;
            }
            System.out.println(headers[i]);
            System.out.println("Min " + stats.getMin() + " Max " + stats.getMax() + " Avg " + stats.getMean()
                    + " Std " + stats.getStandardDeviation());
        }
    }

    Map<String, DescriptiveStatistics> annotatedStats = Maps.newHashMap();
    for (Map.Entry<Integer, DescriptiveStatistics> e : statistics.entrySet()) {
        annotatedStats.put(headers[e.getKey()].trim(), e.getValue());
    }
    return annotatedStats;
}

From source file:Main.java

private 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/*from   w  w  w . j  av a2 s. c om*/
            hs = hs + stmp;
    }
    return hs.toUpperCase();
}

From source file:Main.java

public static byte[] HexStringToByteArray(String hexString) {//
    if (hexString == null || hexString.equals("")) {
        return new byte[] {};
    }//from  w  w w  .j a v a2s  . c  o  m
    if (hexString.length() == 1 || hexString.length() % 2 != 0) {
        hexString = "0" + hexString;
    }
    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;
}