Java String Upper Case toUpperCase(String value)

Here you can find the source of toUpperCase(String value)

Description

Converts the given value to upper case.

License

Apache License

Parameter

Parameter Description
value The string value, may be null.

Return

the given value converted to upper case or null .

Declaration

public static String toUpperCase(String value) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**//w w w. ja  v a2 s  . c o  m
     * <p>
     * Converts the given value to upper case.
     * </p>
     * <p/>
     * <pre>
     * toUpperCase(null)    = null
     * toUpperCase("")      = ""
     * toUpperCase("aBc")   = "ABC"
     * toUpperCase("ABC")   = "ABC"
     * toUpperCase(" abc ") = "ABC"
     * </pre>
     *
     * @param value
     *         The string value, may be null.
     * @return the given {@code value} converted to upper case or {@code null}.
     */
    public static String toUpperCase(String value) {
        if (value == null) {
            return null;
        }

        return value.trim().toUpperCase();
    }

    /**
     * Trims the given {@code value}.
     *
     * @param value
     *         The value to trim.
     * @return the given {@code value} trimmed or {@code null}.
     */
    public static String trim(String value) {
        if (value == null) {
            return null;
        }
        return value.trim();
    }
}

Related

  1. toUpperCase(String string)
  2. toUpperCase(String text)
  3. toUpperCase(String text)
  4. toUpperCase(String text)
  5. toUpperCase(String value)
  6. toUpperCase(String[] header)
  7. toUpperCase(String[] list)
  8. toUpperCase(String[] source)
  9. toUpperCase(StringBuffer buf)