I just announced the new Spring 5 modules in REST With Spring:

>> CHECK OUT THE COURSE

This article is part of a series:
• Java String.String()
• Java String.toLowerCase()
• Java String.codePointCount()
• Java String.codePointAt()
• Java String.concat()
• Java String.contains()
• Java String.copyValueOf()
• Java String.endsWith()
• Java String.format()
• Java String.getBytes()
• Java String.indexOf()
• Java String.intern()
• Java String.isEmpty()
• Java String.lastIndexOf()
• Java String.regionMatches()
• Java String.replace()
• Java String.replaceAll()
• Java String.split()
• Java String.startsWith()
• Java String.subSequence()
• Java String.substring()
• Java String.toLowerCase()
• Java String.toUpperCase()
• Java String.trim()
• Java String.valueOf()

The method toLowerCase() converts all characters of a String to lower case. If no Locale is passed to the method, then it will use the default Locale.

However, it may produce unexpected results if it’s run on a system whose default Locale is different. To avoid this, we can simply pass the Locale to the method.

Available Signatures

public String toLowerCase(Locale locale)
public String toLowerCase()

Example

@Test
public void whenConvertToLowerCase_thenCorrect() {
    String s = "WELCOME to BAELDUNG!";
    
    assertEquals("welcome to baeldung!", s.toLowerCase());
}

I just announced the new Spring 5 modules in REST With Spring:

>> CHECK OUT THE LESSONS