W3cubDocs

/Dart 2

compareTo method

int compareTo (String other)
override

Compares this string to other.

Returns a negative value if this is ordered before other, a positive value if this is ordered after other, or zero if this and other are equivalent.

The ordering is the same as the ordering of the code points at the first position where the two strings differ. If one string is a prefix of the other, then the shorter string is ordered before the longer string. If the strings have exactly the same content, they are equivalent with regard to the ordering. Ordering does not check for Unicode equivalence. The comparison is case sensitive.

Implementation

int compareTo(String other);

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-core/String/compareTo.html