Java String Lower Case toLowerCase(String str)

Here you can find the source of toLowerCase(String str)

Description

cast a string a lower case String, is faster than the String.toLowerCase, if all Character are already Low Case

License

LGPL

Parameter

Parameter Description
str a parameter

Return

lower case value

Declaration

public static String toLowerCase(String str) 

Method Source Code

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

public class Main {
    /**/*from  ww  w .j a v a 2s .  c  o m*/
     * cast a string a lower case String, is faster than the String.toLowerCase, if all Character are already Low Case
     * @param str
     * @return lower case value
     */
    public static String toLowerCase(String str) {
        int len = str.length();
        char c;
        for (int i = 0; i < len; i++) {
            c = str.charAt(i);
            if (!((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9'))) {
                return str.toLowerCase();
            }
        }

        return str;
    }

    public static int length(String str) {
        if (str == null)
            return 0;
        return str.length();
    }
}

Related

  1. toLowerCase(String s)
  2. toLowerCase(String s)
  3. toLowerCase(String s, int start, int end)
  4. toLowerCase(String source)
  5. toLowerCase(String str)
  6. toLowerCase(String str)
  7. toLowerCase(String str)
  8. toLowerCase(String str)
  9. toLowerCase(String str)