- String Class methods
- toUpperCase() and toLowerCase()-
- Example-
- String trim() method-
- Example-
- startsWith() and endsWith() method-
- Example-
- Output-
- charAt() method-
- Example-
- Output-
- length() method-
- Example-
- Output-
- intern() method-
- Example-
- Output-
- valueOf() method-
- Example-
- Output-
- replace() method-
- Example-
String Class methods
java.lang.String provides us with many methods that allow us to perform various operations on strings like rimming, converting, comparing, concatenating, replacing and much more. Below, the methods are discussed with examples.
toUpperCase() and toLowerCase()-
Example-
String trim() method-
This method will remove the space from after and before the string.
Example-
Output-
startsWith() and endsWith() method-
Example-
Output-
charAt() method-
This method will provide you with the character at the specific index.
Example-
Output-
length() method-
This method will allow you to provide the length of the string.
Example-
Output-
intern() method-
Example-
Output-
valueOf() method-
Example-
Output-
replace() method-
This method will allow you to replace the second string with the first string
Example-
Output-