Java – String toLowerCase() method

In this article, we will discuss how to convert each individual characters inside a String into a lowercase character using String’s toLowerCase() method

1. String’s toLowerCase () method:

  • This String method is used to convert invoking sequence/string into lowercase characters
  • That’s all character present in string/sequence

1.1 Method Signature:

public String toLowerCase();

1.2 Returns:

  • String converted to lowercase

2. Examples on toLowerCase() method:

2.1 Convert invoking String into Lowercase

StringToLowerCaseMethod.java

package in.bench.resources.string.methods;

public class StringToLowerCaseMethod {

	public static void main(String[] args) {

		// sample URL string
		String url = "BenchResources.Net";

		// convert all characters
		// present inside string into lower-case
		String lowerCase = url.toLowerCase();

		// print to console - converted lower-case string
		System.out.println("Converted lower-case is : "
				+ lowerCase);
	}
}

Output:

Converted lower-case is : benchresources.net

Hope, you found this article very helpful. If you have any suggestions or want to contribute any other way or tricky situation you faced during Interview hours, then share with us. We will include that code here.

Related Articles:

References:

Happy Coding !!
Happy Learning !!

Java - String toString() method
Java - String toCharArray() method