All String Methods
The String class has a set of built-in methods that you can use on strings.
Method Description
charAt() Returns the character at the specified index (position)
codePointAt() Returns the Unicode of the character at the specified index
codePointBefore() Returns the Unicode of the character before the specified inde
codePointCount() Returns the number of Unicode values found in a string.
compareTo() Compares two strings lexicographically
compareToIgnoreCase() Compares two strings lexicographically, ignoring case differen
concat() Appends a string to the end of another string
contains() Checks whether a string contains a sequence of characters
contentEquals() Checks whether a string contains the exact same sequence of
specified CharSequence or StringBuffer
copyValueOf() Returns a String that represents the characters of the charact
endsWith() Checks whether a string ends with the specified character(s)
equals() Compares two strings. Returns true if the strings are equal, an
equalsIgnoreCase() Compares two strings, ignoring case considerations
format() Returns a formatted string using the specified locale, format s
arguments
getBytes() Converts a string into an array of bytes
getChars() Copies characters from a string to an array of chars
hashCode() Returns the hash code of a string
indexOf() Returns the position of the first found occurrence of specified
string
intern() Returns the canonical representation for the string object
isEmpty() Checks whether a string is empty or not
join() Joins one or more strings with a specified separator
lastIndexOf() Returns the position of the last found occurrence of specified
string
length() Returns the length of a specified string
matches() Searches a string for a match against a regular expression, an
matches
offsetByCodePoints() Returns the index within this String that is offset from the give
codePointOffset code points
regionMatches() Tests if two string regions are equal
replace() Searches a string for a specified value, and returns a new strin
specified values are replaced
replaceAll() Replaces each substring of this string that matches the given
expression with the given replacement
replaceFirst() Replaces the first occurrence of a substring that matches the
expression with the given replacement
split() Splits a string into an array of substrings
startsWith() Checks whether a string starts with specified characters
subSequence() Returns a new character sequence that is a subsequence of th
substring() Returns a new string which is the substring of a specified strin
toCharArray() Converts this string to a new character array
toLowerCase() Converts a string to lower case letters
toString() Returns the value of a String object
toUpperCase() Converts a string to upper case letters
trim() Removes whitespace from both ends of a string
valueOf() Returns the string representation of the specified value