toLowerCase()方法是String类方法,用于将给定的字符串转换为小写。 Syntax: 句法: String String_object.toLowerCase(); Here, String_object is a String object which we have to convert into lowercase. The method does not change the string; it returns the lowercase converted string. 在这里, String_...
We’ve created aStringcontaining all special characters we need and then checked if it contains our specific character. 4. Conclusion In this quick article, we’ve shown how to check if aStringcontains required characters.In the first scenario, we used regular expressions while in the second we...
ThetoLowerCase()method is a member of thejava.lang.Stringclass, making it accessible for all Java strings. ThetoLowerCase()method transforms aStringby converting all of its characters to lowercase, using theLocalerules if specified. It does not change the characters that are already in lowercas...
String toUpperCase(Locale locale): It converts the string into a UpperCase string using the rules defined by the specified Locale. String toUpperCase(): It is equavalent totoUpperCase(Locale.getDefault()). Example: toUpperCase() method importjava.util.Locale;publicclassUpperCaseExample{publicstaticv...
如上所言,“LITTLE”.toLowerCase()在不同的语言环境下返回的结果是不同的,也就是说,toLowerCase()方法(注意,这里是无参数的方法)是区域敏感的。而如果想得到统一的结果的话,可以调用toLowerCase(Locale.ROOT) (Java 8的建议)或toLowerCase(Locale.ENGLISH) (Java 7以前的建议)。toUpperCase同理。
Examples of Java String to Lowercase Here are the following examples mentioned below: Example #1 In this example, the first line of the main method instantiated an object to take input from the user. After that displaying a message to enter an input sentence. In the next line, the input s...
Case mapping is based on the Unicode Standard version specified by the java.lang.Character Character class. Since case mappings are not always 1:1 char mappings, the resulting String may be a different length than the original String. Examples of lowercase mappings are in the following table: ...
String String_object.toLowerCase(); Here,String_objectis a String object which we have to convert into lowercase. The method does not change the string; it returns the lowercase converted string. Example: Input: str = "Welcome at IncludeHelp!" Function call: ans = str.toLowerCase() Output...
Java - String toLowerCase() Method - This method has two variants. The first variant converts all of the characters in this String to lower case using the rules of the given Locale. This is equivalent to calling toLowerCase(Locale.getDefault()).
Below is an example to convert the characters in a string to lower case by passing the Locale value to the toLowerCase() method − Open Compiler packagecom.turialspoint;importjava.util.Locale;publicclassStringDemo{publicstaticvoidmain(String[]args){Stringstr1="Self Learning Center";// using...