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 String byte2HexStr(byte[] b, int length) {
    String hs = "";
    String stmp = "";
    for (int n = 0; n < length; ++n) {
        stmp = Integer.toHexString(b[n] & 0xFF);
        if (stmp.length() == 1)
            hs = hs + "0" + stmp;
        else {/*from   ww w  .  j  av  a  2 s .  c  o m*/
            hs = hs + stmp;
        }
        hs = hs + ",";
    }
    return hs.toUpperCase();
}

From source file:org.sakaiproject.imagegallery.springutil.SqlScriptParser.java

/**
 * Add primitive support for a few common ways of changing the statement
 * terminator from the usual ";". This is particularly useful for Oracle DDL:
 * //from   w w w  .j ava2 s . c o m
 * <pre> set terminator off
 * create or replace trigger IMAGE_GALLERY_IMAGE_TRIGGER
 * before insert on IMAGE_GALLERY_IMAGE_T
 *   for each row when (NEW.ID is null)
 *   begin
 *     select IMAGE_GALLERY_IMAGE_S.NEXTVAL into :NEW.ID from dual;
 *   end;
 * / </pre>
 * 
 * @return the new character to terminate statements or null if the line
 * had nothing to do with statement delimiters.
 */
private static Character parseForNewStatementDelimiter(String line) {
    Character newDelimiter = null;
    String statement = line.toUpperCase();
    if (statement.startsWith("SET SQLTERMINATOR ")) {
        // Oracle conventions: "OFF" will make the parser ignore semicolons,
        // but continue to take a slash ("/") as the signal to execute
        // the statement or block. "ON" will make the parser notice
        // whatever the usual terminator is. Any other value will be
        // taken as the new terrminator character.
        if (statement.endsWith("OFF")) {
            newDelimiter = Character.valueOf('/');
        } else if (statement.endsWith("ON")) {
            newDelimiter = Character.valueOf(';');
        } else {
            newDelimiter = Character.valueOf(line.charAt(line.length() - 1));
        }
    } else if (statement.startsWith("--#SET TERMINATOR ")) {
        // DB2 conventions.
        newDelimiter = Character.valueOf(line.charAt(line.length() - 1));
    }

    return newDelimiter;
}

From source file:Main.java

public static String byte2hex(byte[] bytes) throws Exception {
    try {/* w w w  . ja  va2 s . c  om*/
        String hs = "";
        String stmp = "";
        for (int i = 0; i < bytes.length; i++) {
            stmp = (java.lang.Integer.toHexString(bytes[i] & 0XFF));
            if (stmp.length() == 1)
                hs = hs + "0" + stmp;
            else
                hs = hs + stmp;
        }
        return hs.toUpperCase();
    } catch (Exception e) {
        throw new Exception(e);
    }
}

From source file:com.izforge.izpack.util.StringTool.java

/**
     * The same as startsWith but ignores the case.
     *//from  w ww .  j  av a  2s.  co  m
     * @param str    The String to search in
     * @param prefix The string to search for
     * @return rue if str starts with prefix
     */
    public static boolean startsWithIgnoreCase(String str, String prefix) {
        return (str != null) && (prefix != null) && str.toUpperCase().startsWith(prefix.toUpperCase());
    }

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

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

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

From source file:com.streamsets.pipeline.lib.el.StringEL.java

@ElFunction(prefix = "str", name = "toUpper", description = "Converts all of the characters in the argument string to uppercase")
public static String toUpper(@ElParam("string") String string) {
    return string.toUpperCase();
}

From source file:Main.java

public static final String bytesToHexString(byte[] bArray) {
    StringBuffer sb = null;/*from   w  ww.  j  av a 2 s.c o m*/
    String sTemp;

    if (bArray == null || bArray.length <= 0) {
        return null;
    }
    sb = new StringBuffer(bArray.length);
    for (int i = 0; i < bArray.length; i++) {
        sTemp = Integer.toHexString(0xFF & bArray[i]);
        if (sTemp.length() < 2)
            sb.append(0);
        sb.append(sTemp.toUpperCase());
    }
    return sb.toString();
}

From source file:com.glaf.shiro.SecurityConfig.java

public static String getString(String key) {
    if (hasObject(key)) {
        String value = filterChainDefinitionMap.get(key);
        if (value == null) {
            value = filterChainDefinitionMap.get(key.toUpperCase());
        }//w w  w . j a va 2 s  .  c  om
        return value;
    }
    return null;
}

From source file:de.itsvs.cwtrpc.core.pattern.PatternFactory.java

public static Pattern compile(String patternType, MatcherType matcherType, String pattern)
        throws IllegalArgumentException {
    final PatternType convertedPatternType;

    Assert.notNull(patternType, "'patternType' must not be null");
    try {/*from   w  w w.  j  a v a  2  s  .  c  o  m*/
        convertedPatternType = PatternType.valueOf(patternType.toUpperCase());
    } catch (IllegalArgumentException e) {
        throw new IllegalArgumentException("Pattern type '" + patternType + "' is unsupported");
    }

    return compile(convertedPatternType, matcherType, pattern);
}

From source file:com.baidu.rigel.biplatform.ac.util.TimeDimensionUtils.java

/**
 * ??//w  ww  .j a  v a 2  s  .co m
 * 
 * @param timeStr 
 * @param timeType ??
 * @param timeFormat ??
 * @return timeMember ?member
 * @throws ParseException parse?
 */
public static MiniCubeMember createTimeMember(String timeStr, TimeType timeType, String timeFormat)
        throws ParseException {
    if (StringUtils.isBlank(timeStr) && timeType == null) {
        throw new IllegalArgumentException(
                "timeStr is blank or timeType is null, timeStr:" + timeStr + " timeType:" + timeType);
    }

    Calendar calendar = null;
    String dateFormat = StringUtils.isBlank(timeFormat) ? timeType.getFormat() : timeFormat;
    if (dateFormat.toUpperCase().contains("QN")) {
        int year = Integer.parseInt(timeStr.substring(0, 4));
        int quarter = Integer.parseInt(timeStr.substring(5));
        // Calendar?1
        int month = (quarter - 1) * 3;
        calendar = new GregorianCalendar(year, month, 1);
    } else {
        SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
        Date date = sdf.parse(timeStr);
        calendar = Calendar.getInstance();
        calendar.setTime(date);
    }

    int quarter = calendar.get(Calendar.MONTH) / 3 + 1;
    String caption = null;
    MiniCubeLevel level = new MiniCubeLevel("level_" + timeType);

    if (timeType.equals(TimeType.TimeYear)) {
        caption = calendar.get(Calendar.YEAR) + "";
        level.setType(LevelType.TIME_YEARS);
    } else if (timeType.equals(TimeType.TimeQuarter)) {
        caption = calendar.get(Calendar.YEAR) + "_Q" + quarter;
        level.setType(LevelType.TIME_QUARTERS);
    } else if (timeType.equals(TimeType.TimeMonth)) {
        caption = calendar.get(Calendar.YEAR) + "_" + (calendar.get(Calendar.MONTH) + 1);
        level.setType(LevelType.TIME_MONTHS);
    } else if (timeType.equals(TimeType.TimeWeekly)) {
        caption = calendar.get(Calendar.YEAR) + "_W" + calendar.get(Calendar.WEEK_OF_YEAR);
        level.setType(LevelType.TIME_WEEKS);
    } else if (timeType.equals(TimeType.TimeDay)) {
        caption = DEFAULT_SIMPLE_DATEFORMAT.format(calendar.getTime());
        level.setType(LevelType.TIME_DAYS);
    }

    MiniCubeMember member = new MiniCubeMember(timeStr);
    member.setCaption(caption);
    member.setVisible(true);
    member.setLevel(level);
    LOG.info("time member:" + member);
    return member;
}