|Modifier and Type||Method and Description|
Compares the sequence and the string lexicographically.
Position of the last byte of this sequence in the file (exclusive).
Returns the index within this sequence of the first occurrence of the specified substring.
int indexOf(String str)
The returned index is the smallest value k for which:
If no such value of k exists, thenthis.startsWith(str, k)
str- the substring to search for.
-1if there is no such occurrence.
int compareTo(String anotherString)
0exactly when the equals(Object) method would return
This is the definition of lexicographic ordering. If two strings are
different, then either they have different characters at some index
that is a valid index for both strings, or their lengths are different,
or both. If they have different characters at one or more index
positions, let k be the smallest such index; then the string
whose character at position k has the smaller value, as
determined by using the < operator, lexicographically precedes the
other string. In this case,
compareTo returns the
difference of the two character values at position
the two string -- that is, the value:
If there is no index position at which they differ, then the shorter string lexicographically precedes the longer string. In this case,this.charAt(k)-anotherString.charAt(k)
compareToreturns the difference of the lengths of the strings -- that is, the value:
Stringto be compared.
0if the argument string is equal to this string; a value less than
0if this string is lexicographically less than the string argument; and a value greater than
0if this string is lexicographically greater than the string argument.
Copyright © 2016. All rights reserved.