System Namespace String Class
Compares two specified String objects, ignoring or honoring their case, and honoring culture-specific information about their formatting.
[ VB ]
<Serializable>
Overloads Public Shared Function Compare ( _
ByVal strA As String, _
ByVal strB As String, _
ByVal ignoreCase As Boolean, _
ByVal culture As CultureInfo _
) As Integer
[ C# ]
[ Serializable ]
public static int Compare (
string strA,
string strB,
bool ignoreCase,
CultureInfo culture
);
[ C++ ]
[ Serializable ]
public: static int Compare (
String* strA,
String* strB,
bool ignoreCase,
CultureInfo* culture
);
[ JScript ]
public Serializable
static function Compare (
strA : String,
strB : String,
ignoreCase : Boolean,
culture : CultureInfo
) : int;
- strA
- The first String.
- strB
- The second String.
- ignoreCase
- A Boolean indicating a case-sensitive or insensitive comparison. ( true indicates a case-insensitive comparison. )
- culture
- A CultureInfo object that supplies culture-specific formatting information.
A 32-bit signed integer indicating the lexical relationship between the two comparands.
Value |
Meaning |
Less than zero |
strA is less than strB. |
Zero |
strA equals strB. |
Greater than zero |
strA is greater than strB. |
culture specifies a CultureInfo object, which provides culture-specific information that can affect the comparison.
By definition, any String, including the empty string, compares greater than a null reference; and two null references compare equal to each other.
String Members String.Compare Overload List Int32 CompareOrdinal CompareTo IsPrefix Boolean