Strings Flashcards
1
Q
String Method: str1.equals(str2)
A
returns true if and only if str1 and str2 have the same values
2
Q
str1.compareTo(str2)
A
returns a positive number if str1 is greater than str2 (more characters)
3
Q
str.substring(from)
A
returns a substring of str starting at the from position to the end
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
5
Q
str.indexOf(s)
A
returns the starting position of the first occurrence of s in str, or -1 if not found