String class methods

String class methods

List of methods which present in String class.

1. char charAt(int index)
return character from the specified index position.
2. int compareTo(Object o)
Compare string with another object.
3. int compareTo(String anotherString)
Compare two strings and return integer output
1 means first string is greater than second string,  -1 means first string is less than second string, 0 means both strings are equal.
4. int compareToIgnoreCase(String str)
compare two string with case insensitive.
5. String concat(String str)
concat two strings.
6. boolean contentEquals(StringBuffer sb)
return true if and only if the sequence of string is same as the specified string buffer.
7. boolean endsWith(String suffix)
return true if string ends with specified suffix.
8. boolean equals(Object anObject)
Compare the string with specified object.
9. boolean equalsIgnoreCase(String anotherString)
Compare the string with another string with case insensitive.
10. byte getBytes()
Encode the string in sequence of byte.
11. int hashCode()
return the hash code for the string.
12. int indexOf(int ch)
return index position of first occurrence of specified character.
13. int indexOf(int ch, int fromIndex)
return index position of first occurrence of specified character start from specified index.
14. int indexOf(String str)
return index of first occurrence of specified string.
15. int lastIndexOf(int ch)
return index of last occurrence of specified characters.
16. int length()
return the length of string.
17. boolean matches(String regex)
return true when string matches with given regular expression.
18. String replace(char oldChar, char newChar)
replacing all all character with new character in a string.
19. String replaceAll(String regex, String replacement)
replace each substring of string which matches with given regular expression from new string.
20. String[] split(String regex)
split string around matches of given regular expression.
21. String trim()
return string omitted leading and trailing white spaces.
22. String toUpperCase() 
Convert all the characters of a string in upper case.
23. String toString()
Conversion of object in to string.
24. String substring(int beginIndex)
return substring from the string start from specified index.
25. String substring(int beginIndex, int endIndex)
return substring from the string from specified start and end index.