Java String Upper Case toUpperCase(String value)

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

Description

Returns upper-case string if a string is not null or if the trimmed value has a length of > 0.

License

Open Source License

Parameter

Parameter Description
value - string to test

Return

value - string in upperCase

Declaration

public static String toUpperCase(String value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from   w w  w.  ja v  a 2s .c  o m*/
     * Returns upper-case string if a string is not null or if the trimmed value has a length of > 0.
     * 
     * @param value - string to test
     * @return value - string in upperCase
     */
    public static String toUpperCase(String value) {

        if (!isNullOrEmpty(value)) {
            value = value.toUpperCase();
        }

        return value;
    }

    /**
     * Returns true if a string is null or if the trimmed value has a length of 0.
     * 
     * @param value - string to test
     * @return - true it null or empty
     */
    public static boolean isNullOrEmpty(String value) {
        boolean status = false;
        if (value == null) {
            status = true;
        } else if (value.trim().length() == 0) {
            status = true;
        }

        return status;
    }
}

Related

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