0% found this document useful (0 votes)
4 views3 pages

Java String Reference

The document provides a comprehensive list of built-in methods available in the Java String class, detailing their descriptions and return types. Methods include charAt(), concat(), equals(), and replace(), among others, each serving specific functions for string manipulation. This serves as a reference for developers working with strings in Java programming.

Uploaded by

xijab92446
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Java String Reference

The document provides a comprehensive list of built-in methods available in the Java String class, detailing their descriptions and return types. Methods include charAt(), concat(), equals(), and replace(), among others, each serving specific functions for string manipulation. This serves as a reference for developers working with strings in Java programming.

Uploaded by

xijab92446
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

 Tutorials  Exercises  Services   Sign Up Log in

HTML
 CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++

ADVERTISEMENT

Java String Methods


❮ Previous Next ❯

All String Methods


The String class has a set of built-in methods that you can use on strings.

Method Description Return Type

charAt() Returns the character at the specified index char


(position)

codePointAt() Returns the Unicode of the character at the int


specified index

codePointBefore() Returns the Unicode of the character before the int


specified index

codePointCount() Returns the number of Unicode values found in a int


string.

compareTo() Compares two strings lexicographically int

compareToIgnoreCase() Compares two strings lexicographically, ignoring int


case differences

concat() Appends a string to the end of another string String

contains() Checks whether a string contains a sequence of boolean


characters

contentEquals() Checks whether a string contains the exact same boolean


sequence of characters of the specified
CharSequence or StringBuffer
copyValueOf()
Tutorials 
Returns a String that represents
Exercises  Services 
the character array
 the characters of String
Sign Up Log in

HTML
 CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++
endsWith() Checks whether a string ends with the specified boolean
ADVERTISEMENT character(s)

equals() Compares two strings. Returns true if the strings boolean


are equal, and false if not

equalsIgnoreCase() Compares two strings, ignoring case boolean


considerations

format() Returns a formatted string using the specified String


locale, format string, and arguments

getBytes() Converts a string into an array of bytes byte[]

getChars() Copies characters from a string to an array of void


chars

hashCode() Returns the hash code of a string int

indexOf() Returns the position of the first found occurrence int


of specified characters in a string

intern() Returns the canonical representation for the String


string object

isEmpty() Checks whether a string is empty or not boolean

join() Joins one or more strings with a specified String


separator

lastIndexOf() Returns the position of the last found occurrence int


of specified characters in a string

length() Returns the length of a specified string int

matches() Searches a string for a match against a regular boolean


expression, and returns the matches

offsetByCodePoints() Returns the index within this String that is offset int
from the given index by codePointOffset code
points

regionMatches() Tests if two string regions are equal boolean

replace() Searches a string for a specified value, and String


returns a new string where the specified values
are replaced
replaceAll()
Tutorials 
Replaces each substring of 
Exercises  Services 
this string that
matches the given regular expression with the
String
Sign Up Log in

HTML
 CSS JAVASCRIPT given
SQL replacement
PYTHON JAVA PHP HOW TO W3.CSS C C++

replaceFirst()
ADVERTISEMENT Replaces the first occurrence of a substring that String
matches the given regular expression with the
given replacement

split() Splits a string into an array of substrings String[]

startsWith() Checks whether a string starts with specified boolean


characters

subSequence() Returns a new character sequence that is a CharSequence


subsequence of this sequence

substring() Returns a new string which is the substring of a String


specified string

toCharArray() Converts this string to a new character array char[]

toLowerCase() Converts a string to lower case letters String

toString() Returns the value of a String object String

toUpperCase() Converts a string to upper case letters String

trim() Removes whitespace from both ends of a string String

valueOf() Returns the string representation of the specified String


value

Related Pages
Java Strings Tutorial

❮ Previous Next ❯

W3schools Pathfinder
Track your progress - it's free! Sign Up Log in

You might also like