Compares two strings by an ordinal comparison.
[Visual Basic] Overloads Public Shared Function CompareOrdinal( _ ByVal strA As String, _ ByVal strB As String _ ) As Integer [C#] public static int CompareOrdinal( string strA, string strB ); [C++] public: static int CompareOrdinal( String* strA, String* strB ); [JScript] public static function CompareOrdinal( strA : String, strB : String ) : int;
Permission | Description |
---|---|
A negative integer | If the first string is less than the second string. |
0 | If the two strings are equal |
A positive integer | If the first string is greater than the second string. |
The CompareOrdinal method compares two specified strings and returns an integer representation of their relationship.
To compare strings under the rules of specified CultureInfo, use Compare or CompareTo
In the comparison of two string objects, a null string is considered less than a non-null string. If both strings are null, they are considered equal.
String Class | String Members | System Namespace | String.CompareOrdinal Overload List | Int32