Compares and determines the sorting order of this instance and the specified string.
[Visual Basic] Overloads Public Function CompareTo( _ ByVal strB As String _ ) As Integer [C#] public int CompareTo( string strB ); [C++] public: int CompareTo( String* strB ); [JScript] public function CompareTo( strB : String ) : int;
Value | Condition |
---|---|
A negative integer | If this instance is less than the string. |
Zero | If this instance and the string have the same value. |
A positive integer | If this instance is greater than the string. |
A positive integer | If the string is null. |
The comparison of two string values is case-sensitive and uses the CultureInfo of the current thread to determine the ordering. As a special case, an instance of string is considered to be greater than a null reference.
String Class | String Members | System Namespace | String.CompareTo Overload List | Int32