Java String Upper Case toUpperCase(String[] list)

Here you can find the source of toUpperCase(String[] list)

Description

convert to uppercase.

License

Apache License

Parameter

Parameter Description
list input list

Return

converted array

Declaration

public static String[] toUpperCase(String[] list) 

Method Source Code

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

public class Main {
    /**/* w w  w .  j av a  2  s. c om*/
     * convert to uppercase.
     * 
     * @param list input list
     * @return converted array
     */
    public static String[] toUpperCase(String[] list) {
        if (isNullOrEmpty(list))
            return list;
        String[] newList = new String[list.length];
        for (int i = 0; i < list.length; i++) {
            newList[i] = list[i].toUpperCase();
        }
        return newList;
    }

    /**
     * Returns true if the data is null or empty string.
     * 
     * @param data data
     * @return boolean
     */
    public static boolean isNullOrEmpty(String data) {
        return data == null || data.trim().length() == 0;
    }

    /**
     * Returns true if the data is null or empty string array (length == 0).
     * 
     * @param data data
     * @return boolean
     */
    public static boolean isNullOrEmpty(String[] data) {
        return data == null || data.length == 0;
    }
}

Related

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