asp.net.ph

String.Compare Method ( String, String, Boolean, CultureInfo )

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;

Parameters

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.

Return Value

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.

Exceptions


Exception Type Condition
ArgumentNullException culture is a null reference ( Nothing in Visual Basic ).

Remarks

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.

See Also

String Members   String.Compare Overload List   Int32   CompareOrdinal   CompareTo   IsPrefix   Boolean Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph