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.metamx.cache.CacheExecutorFactory.java

@JsonCreator
public static CacheExecutorFactory from(String str) {
    return Enum.valueOf(CacheExecutorFactory.class, str.toUpperCase());
}

From source file:com.book.identification.FileType.java

public static FileType valueOf(File file) {
    String extension = FilenameUtils.getExtension(file.getName());
    return FileType.valueOf(extension.toUpperCase());

}

From source file:Main.java

/**
 * Prepares the Swing GUI./*from  w  w  w.j a  va2s.  c o m*/
 *
 * @param appName
 *            The application name. This is used to create the names of environment variables check for locale and
 *            theme overrides. appName "FooBar" for example uses the override environment variables FOOBAR_LANG and
 *            FOOBAR_THEME.
 * @throws Exception
 *             When preparing the GUI failed
 */

public static void prepareGUI(final String appName) throws Exception {
    prepareLocale(appName.toUpperCase() + "_LANG");
    prepareTheme(appName.toUpperCase() + "_THEME");
}

From source file:Main.java

private static final String toInitialCap(String word) {
    if (word != null && word.length() > 1) {
        return String.valueOf(word.toUpperCase().charAt(0)) + word.substring(1).toLowerCase();
    }/*from w  w  w . j a va2 s . c  o  m*/
    return "";
}

From source file:Main.java

public static void uppercaseEditText(final EditText editText) {
    editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS
            | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    editText.addTextChangedListener(new TextWatcher() {

        @Override//w  ww  .ja v a2 s  .c  om
        public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
        }

        @Override
        public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
        }

        @Override
        public void afterTextChanged(Editable arg0) {
            String s = arg0.toString();
            if (!s.equals(s.toUpperCase().trim())) {
                s = s.toUpperCase().trim();
                editText.setText(s);
                editText.setSelection(s.length());
            }
        }
    });
}

From source file:Main.java

@SuppressWarnings({ "unchecked", "rawtypes" })
public static void UpperCaseItems(Collection collection) {

    //Basic iterator ... cannot modify collection using this method.
    Iterator iterator = collection.iterator();
    while (iterator.hasNext()) {
        Object object = iterator.next();
        if (object instanceof String) {
            System.out.println(((String) object).toUpperCase());
            //object = ((String) object).toUpperCase();  doesn't actually change the underlying object.
        }/*from ww w . j  a va 2  s  .  c  om*/
    }

    //old school for loop ... can modify collection. This is not a structural change to the collection, just a change to the members. Structural collection changes in a loop is not recommended.
    if (collection instanceof ArrayList) {
        for (int i = 0; i < collection.size(); i++) {
            Object object = ((ArrayList) collection).get(i);
            String item = ((String) object);
            ((ArrayList) collection).set(i, item.toUpperCase());
        }
    }
}

From source file:Main.java

public static boolean isPalindrome(String inputString) {
    int len = inputString.length();
    if (len <= 1) {
        return true;
    }// www  .ja  va2 s  .c om
    String newStr = inputString.toUpperCase();
    boolean result = true;
    int counter = len / 2;
    for (int i = 0; i < counter; i++) {
        if (newStr.charAt(i) != newStr.charAt(len - 1 - i)) {
            result = false;
            break;
        }
    }
    return result;
}

From source file:Main.java

/**
 * Checks if the String representation of a Function
 * is of type SUM//from   w ww.  j a v a  2  s . co m
 * @param in Func as String
 * @return true or false
 */
public static boolean isUDFSUMorSUM(String in) {
    return in.equals(UDF_AGR_FUNC_PAILLIER) || in.equals(UDF_AGR_FUNC_ELGAMAL)
            || in.toUpperCase().equals(SUPPORTED_FUNCS[0]);
}

From source file:com.bazaarvoice.lassie.screenboard.widgets.Color.java

/**
 * Parse Color name into the corresponding {@link Color} value.
 *
 * @param name The name of the expected enum.
 * @return The Color enum./*w ww. jav a2s.c om*/
 */
@JsonCreator
public static Color fromName(String name) {
    checkNotNull(name);
    return Color.valueOf(name.toUpperCase());
}

From source file:Main.java

private static String capitalizeTagNames(String xpath) {
    Matcher m = TAG_PATTERN.matcher(xpath);
    StringBuffer sb = new StringBuffer();
    while (m.find()) {
        String text = m.group();
        m.appendReplacement(sb, Matcher.quoteReplacement(text.toUpperCase()));
    }/*ww  w  . j  av a2s  . co m*/
    m.appendTail(sb);
    return sb.toString();
}