Search code examples
javaarraysstringlowercase

when using a array of strings in java, convert it to lowercase


I got a one dimensional array of strings in java, in which i want to change all strings to lowercase, to afterwards compare it to the original array so i can have the program check whether there are no uppercase chars in my strings/array.

i've tried using x.toLowercase but that only works on single strings. Is there a way for me to convert the whole string to lowercase?

Kind regards, Brand


Solution

  • If you want a short example, you could do the following

    String[] array = ...
    String asString = Arrays.toString(array);
    if(asString.equals(asString.toLowerCase())
       // no upper case characters.