Strings Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

String Method: str1.equals(str2)

A

returns true if and only if str1 and str2 have the same values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

str1.compareTo(str2)

A

returns a positive number if str1 is greater than str2 (more characters)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

str.substring(from)

A

returns a substring of str starting at the from position to the end

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

str.substring(from, to)

A

returns str’s substring starting at the from position and up to but NOT INCLUDING the to position

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

str.indexOf(s)

A

returns the starting position of the first occurrence of s in str, or -1 if not found

How well did you know this?
1
Not at all
2
3
4
5
Perfectly