java string methods Flashcards
(18 cards)
___ is a sequence of character treated as single unit
String
Strings are ___, once a string is created, it cannot be changed.
immutable
commonly used string methods
.length()
.toLowerCase()
.charAt()
.concat()
.equals()
.replace()
.equalsIgnoreCase()
.trim()
.startWith()
.indexOf()
.endWith()
.toUpperCase()
The ___ method returns the length of the string.
.length()
The ____ method returns the character at the specified index.
.charAt()
The ___ method it compares the strings, it return true if
arguments are the same sequence of character (case-sensitive)
.equals()
The ____ method it compares the strings, it return
true if arguments are the same sequence of character but ignoring
case differences.
.equalsIgnoreCase()
The ____ method checks the string starts with the specified prefix.
.startsWith()
The _____ method checks the string ends with the specified
prefix.
.endsWith()
The ____ method converts all characters in a string to
uppercase.
.toUpperCase()
The ____ method converts all characters in a string to
lowercase
.toLowerCase()
The ____ method removes whitespace from the beginning and
end.
.trim()
The ____ method searches for the first occurence of a
character or substring.
.indexOf()
The ____ method checks if a specified characters exists
within a given string.
.contains()
The ____ method combine the specified string to the end of the
first string
.concat()
The ____ method check if the string is empty.
.isEmpty
The ___ method returns a portion of the string from a given
index.
.substring()
The ____ method replace all occurences of a characters in the
string with new characters.
.replace()