System Namespace String Class
Compares this instance with a specified Object.
[ VB ]
<Serializable>
NotOverridable Overloads Public Function CompareTo ( _
ByVal value As Object _
) As Integer Implements IComparable.CompareTo
[ C# ]
[ Serializable ]
public int CompareTo (
object value
);
[ C++ ]
[ Serializable ]
public: __sealed int CompareTo (
Object* value
);
[ JScript ]
public Serializable
function CompareTo (
value : Object
) : int;
- value
- An Object that evaluates to a String.
A 32-bit signed integer indicating the lexical relationship between the two comparands.
Value |
Condition |
Less than zero |
This instance is less than value. |
Zero |
This instance is equal to value. |
Greater than zero |
This instance is greater than value.
-or-
value is a null reference ( Nothing in Visual Basic ).
|
IComparable.CompareTo
value must be a String object.
By definition, any String, including the empty string, compares greater than a null reference ( Nothing in Visual Basic ); and two null references compare equal to each other.
This method performs a case-sensitive operation. The method uses the current culture to determine the ordering of individual characters. Uppercase letters evaluate greater than their lowercase equivalents. The two strings are compared on a character-by-character basis.
String Members String.CompareTo Overload List Compare CompareOrdinal