asp.net.ph

String.CompareTo Method ( Object )

System Namespace   String Class


Compares this instance with a specified Object.

[ VB ]
<Serializable>
NotOverridable Overloads Public Function CompareTo ( _
   ByVal value As Object _
) As Integer Implements IComparable.CompareTo

[ C# ]
[ Serializable ]
public int CompareTo (
   object value
);

[ C++ ]
[ Serializable ]
public: __sealed int CompareTo (
   Object* value
);

[ JScript ]
public Serializable
function CompareTo (
   value : Object
) : int;

Parameters

value
An Object that evaluates to a String.

Return Value

A 32-bit signed integer indicating the lexical relationship between the two comparands.

Value Condition
Less than zero This instance is less than value.
Zero This instance is equal to value.
Greater than zero This instance is greater than value.

-or-

value is a null reference ( Nothing in Visual Basic ).


Implements

IComparable.CompareTo

Exceptions


Exception Type Condition
ArgumentException value is not a String.

Remarks

value must be a String object.

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 performs a case-sensitive operation. The method uses the current culture to determine the ordering of individual characters. Uppercase letters evaluate greater than their lowercase equivalents. The two strings are compared on a character-by-character basis.

See Also

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