String.compareTo
Class Overview | Class Members | This Package | All Packages
Syntax
public int compareTo( String anotherString )
Parameters
- anotherString
the String to be compared.
Returns
the value 0 if the argument string is equal to this string; a value less than 0 if this string is lexicographically less than the string argument; and a value greater than 0 if this string is lexicographically greater than the string argument.
Description
Compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings.