Java.lang.String.toLowerCase() Method

Advertisements


Description

The java.lang.String.toLowerCase(Locale locale) method converts all of the characters in this String to lower case using the rules of the given Locale.

Declaration

Following is the declaration for java.lang.String.toLowerCase() method

public String toLowerCase(Locale locale)

Parameters

  • locale -- use the case transformation rules for this locale.

Return Value

This method returns the String, converted to lowercase.

Exception

  • NA

Example

The following example shows the usage of java.lang.String.toLowerCase() method.

package com.tutorialspoint;

import java.lang.*;
import java.util.*;

public class StringDemo {

  public static void main(String[] args) {
  
    String str1 = "Self Learning Center";

    // using the default system Locale
    Locale defloc = Locale.getDefault();
        
    // converts all upper case letters in to lower case letters
    System.out.println("string value = " + str1.toLowerCase(defloc));
    
    str1 = "WWW.PHOTOFUNTOOS.COM";
    System.out.println("string value = " + str1.toLowerCase(defloc));
  }
}

Let us compile and run the above program, this will produce the following result:

string value = self learning center
string value = www.photofuntoos.com



Advertisements
Advertisements