Java.Lang.String.CompareTo Method
Compares this string to the given string.

Syntax

[Android.Runtime.Register("compareTo", "(Ljava/lang/String;)I", "")]
public int CompareTo (string string)

Parameters

string
the string to compare.

Returns

Documentation for this section has not yet been entered.

Exceptions

TypeReason
Java.Lang.NullPointerExceptionif string is null.

Remarks

Compares this string to the given string.

The strings are compared one char at a time. In the discussion of the return value below, note that char does not mean code point, though this should only be visible for surrogate pairs.

If there is an index at which the two strings differ, the result is the difference between the two chars at the lowest such index. If not, but the lengths of the strings differ, the result is the difference between the two strings' lengths. If the strings are the same length and every char is the same, the result is 0.

[Android Documentation]

Requirements

Namespace: Java.Lang
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1