asp.net.ph

String.Compare Method ( String, String, Boolean )

System Namespace   String Class


Compares two specified String objects, ignoring or honoring their case.

[ VB ]
<Serializable>
Overloads Public Shared Function Compare ( _
   ByVal strA As String, _
   ByVal strB As String, _
   ByVal ignoreCase As Boolean _
) As Integer

[ C# ]
[ Serializable ]
public static int Compare (
   string strA,
   string strB,
   bool ignoreCase
);

[ C++ ]
[ Serializable ]
public: static int Compare (
   String* strA,
   String* strB,
   bool ignoreCase
);

[ JScript ]
public Serializable
static function Compare (
   strA : String,
   strB : String,
   ignoreCase : Boolean
) : 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. )

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.

Remarks

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 uses the current culture to determine the ordering of individual characters. The two strings are compared on a character-by-character basis.

See Also

String Members   String.Compare Overload List   Int32   CompareOrdinal   CompareTo   IsPrefix 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