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

private static String getCheckSum(String aString) {
    int checksum = 0;
    String checkedString = aString.substring(1, aString.indexOf("*"));

    for (int i = 0; i < checkedString.length(); i++) {
        checksum = checksum ^ checkedString.charAt(i);
    }/* w  ww.  j  av  a2 s .c o  m*/

    String hex = Integer.toHexString(checksum);
    if (hex.length() == 1)
        hex = "0" + hex;

    return hex.toUpperCase();
}

From source file:Main.java

private static String cleanNetworkTypeName(String type) {
    /*  if (AVUtils.isBlankString(type)) {
      return "offline";//from  w  w w  .  ja  v a  2s. com
      }*/
    String t = type.toUpperCase();
    if (t.contains("WIFI")) {
        return "WiFi";
    }
    if (type.contains("MOBILE")) {
        return "Mobile";
    }
    return type;
}

From source file:Main.java

private static int extractConditionsOperatorTokens(String relevant, int startPos, Vector<String> list) {
    int pos, pos2, opSize = 5;

    pos = relevant.toUpperCase().indexOf(" AND ", startPos);
    if (pos < 0) {
        pos = relevant.toUpperCase().indexOf(" OR ", startPos);
        opSize = 4;//  w  w  w .  j a  v  a2 s . c  om
    }

    pos2 = relevant.toUpperCase().indexOf(" OR ", startPos);
    if (pos2 > 0 && pos2 < pos) {
        pos = pos2;
        opSize = 4;
    }

    if (pos < 0) {
        list.add(relevant.substring(startPos).trim());
        opSize = 0;
    } else
        list.add(relevant.substring(startPos, pos).trim());

    return pos + opSize;
}

From source file:Main.java

private static int getColorInt(String color) {
    color = color.toUpperCase();
    // following the game's convention. see
    // http://bazaar.launchpad.net/~armagetronad-dev/armagetronad/trunk-armagetronad-work/view/head:/src/render/rFont.cpp#L775
    color = (color == "RESETT") ? "F8F8F8" : color;
    // we make sure the value is valid. (maybe unexpected color for people not using right codes)
    color = color.replaceAll("[^0-9A-F]", "F");
    return Color.parseColor("#" + color);
}

From source file:com.algoTrader.util.ConfigurationUtil.java

public static Configuration getStrategyConfig(String strategyName) {

    if (StrategyImpl.BASE.equals(strategyName.toUpperCase())) {
        return getBaseConfig();
    }/*from  ww w  .j av a2 s .  c  om*/

    CompositeConfiguration strategyConfig = strategyConfigMap.get(strategyName.toUpperCase());
    if (strategyConfig == null) {

        strategyConfig = new CompositeConfiguration();
        strategyConfig.addConfiguration(new SystemConfiguration());
        try {
            strategyConfig.addConfiguration(
                    new PropertiesConfiguration("conf-" + strategyName.toLowerCase() + ".properties"));
            strategyConfig.addConfiguration(new PropertiesConfiguration(baseFileName));
        } catch (ConfigurationException e) {
            logger.error("error loading " + strategyName.toLowerCase() + ".properties", e);
        }
        strategyConfigMap.put(strategyName.toUpperCase(), strategyConfig);
    }
    return strategyConfig;
}

From source file:Main.java

public static DocumentFilter getUpperCaseFilter() {
    return new DocumentFilter() {
        public void insertString(DocumentFilter.FilterBypass fb, int offset, String text, AttributeSet attr)
                throws BadLocationException {
            fb.insertString(offset, text.toUpperCase(), attr);
        }//  w w  w. jav a2 s  . c  om

        public void replace(DocumentFilter.FilterBypass fb, int offset, int length, String text,
                AttributeSet attrs) throws BadLocationException {

            fb.replace(offset, length, text.toUpperCase(), attrs);
        }
    };
}

From source file:com.couchbase.client.core.config.BucketNodeLocator.java

/**
 * Create a new {@link BucketNodeLocator} from a raw bucket type.
 *
 * @param text the raw bucket type./*w  w  w.ja  va2s.co m*/
 * @return the proper enum.
 */
@JsonCreator
public static BucketNodeLocator fromConfig(final String text) {
    if (text == null) {
        return null;
    }
    return valueOf(text.toUpperCase());
}

From source file:Main.java

/** @param phrase1
 * @param phrase2//from   w  ww.j av  a 2 s.c  om
 * @return lexical similarity value in the range [0,1] */
public static double lexicalSimilarity(String phrase1, String phrase2) {
    List<String> pairs1 = wordLetterPairs(phrase1.toUpperCase());
    List<String> pairs2 = wordLetterPairs(phrase2.toUpperCase());
    int intersection = 0;
    int union = pairs1.size() + pairs2.size();
    for (int i = 0; i < pairs1.size(); i++) {
        String pair1 = pairs1.get(i);
        for (int j = 0; j < pairs2.size(); j++) {
            String pair2 = pairs2.get(j);
            if (pair1.equals(pair2)) {
                intersection++;
                pairs2.remove(j);
                break;
            }
        }
    }
    return (2.0 * intersection) / union;
}

From source file:Main.java

/** ExpCalendarUtil.java
 * The number to Week// ww w.j  ava 2 s .  com
 * @param number - Number day of Week (on the code Sunday is equal 7)
 * @return [String] - abbreviated name of the days of the week
 */
public static String number2Week(int number) {
    if (number < 1 || number > 7)
        return null; //Day of Week 1-7
    if (number == 7) {
        number = 1;
    } else {
        number = number + 1;
    }
    final DateFormatSymbols symbols = new DateFormatSymbols(); //use user locale
    final String nameDayOfWeek = symbols.getShortWeekdays()[number]; //Short name or getWeekdays for complete name
    return nameDayOfWeek.toUpperCase(); //name to uppercase
}

From source file:Main.java

public static String getTrainCodeGetDataUrl(String year, String month, String day, String trainCode) {
    return "http://dynamic.12306.cn/TrainQuery/skbcx.jsp?cxlx=cc&date=" + year + month + day + "&trainCode="
            + trainCode.toUpperCase();
}