# String methods in Java


1. str.length(): it returns the length of the string mentioned.
2. str.toLowerCase(): it converts the given characters of string into lower case.
3. str.toUpperCase(): it converts the given characters of string into upper case.
4. str.trim(): it is used to remove the leading and tailing spaces from the array if there are any.
5. str.substring(int begin): it returns a new string by giving the part of a string from where the index is given.
6. 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.
7. str.replace(char old, char new): it replaces the old character with the new character.

#2.
1. str.startsWith(string s): to find the particular starting word of a string/to find the initials.
2. Str.endsWith(string s): to find a particular ending word of the string.
3. str.charAt(int index): to find the particular character present on the index given.
4. str.indexOf(String s): to find the index of the given character.
5. str.lastIndexOf(string s): to find the index of the given character from the end of the array.

#3.
1. str.equals(string s): to check whether the contents of two strings are equal or not.
2. 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.
3. str.compareTo(string s): to compare two strings according to the dictionary order(in accordance with the ASCII codes for cases of characters).
4. str.valueOf(int i): to convert different types of data into a string data types.
