String methods in Java

- str.length(): it returns the length of the string mentioned.
- str.toLowerCase(): it converts the given characters of string into lower case.
- str.toUpperCase(): it converts the given characters of string into upper case.
- str.trim(): it is used to remove the leading and tailing spaces from the array if there are any.
- str.substring(int begin): it returns a new string by giving the part of a string from where the index is given.
- str.substring(int begin, int end): it works the same as the above but the starting and ending index both can be given in the substring.
- str.replace(char old, char new): it replaces the old character with the new character.
#2.
- str.startsWith(string s): to find the particular starting word of a string/to find the initials.
- Str.endsWith(string s): to find a particular ending word of the string.
- str.charAt(int index): to find the particular character present on the index given.
- str.indexOf(String s): to find the index of the given character.
- str.lastIndexOf(string s): to find the index of the given character from the end of the array.
#3.
- str.equals(string s): to check whether the contents of two strings are equal or not.
- str.equalsIgnoreCase(string s): to check whether the contents of two strings are equal or not but it does not depend upon the case of characters.
- str.compareTo(string s): to compare two strings according to the dictionary order(in accordance with the ASCII codes for cases of characters).
- str.valueOf(int i): to convert different types of data into a string data types.

