AppDividend
Latest Code Tutorials

Java String toLowerCase() | Convert String Characters To Lowercase

0

In this example, How To Convert String Characters To Lowercase is today’s topic. Suppose you want to convert any string to all lower characters, then you have to use Java String toLowerCase() method. This method helps us to convert a string into all lowercase characters.

Java String toLowerCase()

The java string toLowerCase() method returns the string in the lowercase letter. In other words, it converts all characters of the string into a lower case letter.

The toLowerCase() method works same as toLowerCase(Locale.getDefault()) method. It internally uses the default locale.

Variants of Function

String toLowerCase():

The toLowerCase() method gets the current value of the default locale using toLowerCase (Locale.getDefault()) method for the instance of the Java Virtual Machine.

This Java Virtual Machine sets default locale during the start of the host environment. However, it can be changed using the setDefault() method.

Syntax

public String toLowerCase()

See the following program.

class LowerCase {
	public static void main(String args[]) {
		// initializing the string
		String s = "Welcome to APPDIVIDEND";
		// converting string s to lowercase letter
		String str = s.toLowerCase();
		System.out.println(str);
	}
}

See the output.

 

Java String toLowerCase()

String toLowerCase(Locale locale)

The toLowerCase(Locale locale) method converts the string into LowerCase using the rules defined by some specified Locale.

Syntax

public String toLowerCase(Locale loc)

Here loc converts all characters into lowercase value using the rules defined in Locale.

See the following program.

import java.util.Locale;

class LowerCase {
	public static void main(String args[]) {
		// initializing the string
		String s = "Welcome to APPDIVIDEND.";
		// converting string s to lowercase letter using Locale method
		String eng = s.toLowerCase(Locale.ENGLISH);
		System.out.println(eng);
		String turkish = s.toLowerCase(Locale.forLanguageTag("tr")); // It shows i without dot
		System.out.println(turkish);
	}
}

See the output.

 

Convert String Characters To Lowercase

Finally, How To Convert String Characters To Lowercase Tutorial With Example is over.

Recommended Posts

Java String toUpperCase() Example

How To Find String Length In Python

Java String toCharArray() Example

Java String compareTo Example

How to find string length In Java

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.