Add Case conversion functions to the article (#26922)
* Add Case conversion functions to the article These functions tell the programmers about converting their string data type value either into upper case letters or lower case letters. * Fix formatting and phrasing
This commit is contained in:
committed by
Manish Giri
parent
784de367a1
commit
78949d9f61
@ -220,5 +220,42 @@ The result will be:
|
||||
Free
|
||||
```
|
||||
|
||||
|
||||
#### String Case Conversion
|
||||
|
||||
1. `.toLowerCase()` - This method will convert the string into lower case characters.
|
||||
Example:
|
||||
```java
|
||||
String text1 = "Welcome99";
|
||||
String text2 = "WELCOME";
|
||||
String text3 = "well";
|
||||
System.out.println(text1.toLowerCase());
|
||||
System.out.println(text2.toLowerCase());
|
||||
System.out.println(text3.toLowerCase());
|
||||
```
|
||||
The output will be:-
|
||||
```
|
||||
welcome99
|
||||
welcome
|
||||
well
|
||||
```
|
||||
2. `.toUpperCase()` - This method will convert the string into upper case characters.
|
||||
Example:
|
||||
|
||||
```java
|
||||
String text1 = "Welcome99";
|
||||
String text2 = "WELCOME";
|
||||
String text3 = "well";
|
||||
System.out.println(text1.toUpperCase());
|
||||
System.out.println(text2.toUpperCase());
|
||||
System.out.println(text3.toUpperCase());
|
||||
```
|
||||
The output will be:-
|
||||
```
|
||||
WELCOME99
|
||||
WELCOME
|
||||
WELL
|
||||
```
|
||||
|
||||
**More Information:**
|
||||
- [String Documentation](https://docs.oracle.com/javase/7/docs/api/java/lang/String.html)
|
||||
|
Reference in New Issue
Block a user