Java String lower case

Introduction

Converts a String to lower case as per String#toLowerCase().

A null input String returns null.

lowerCase(null)  = null
lowerCase("")    = ""
lowerCase("aBc") = "abc"
public class Main {
    public static void main(String[] argv) throws Exception {
        String str = "Demo2s.com";
        System.out.println(lowerCase(str));
    }/*from   w w w.j a v a2s.co m*/
    public static String lowerCase(String str) {
        if (str == null) {
            return null;
        }
        return str.toLowerCase();
    }
}



PreviousNext

Related