Bridge

String..::..Compare Method (String, Int32, String, Int32, Int32)

Compares substrings of two specified String objects and returns an integer that indicates their relative position in the sort order.

Namespace:  System
Assembly:  Bridge (in Bridge.dll)

Syntax


[TemplateAttribute]
public static int Compare(
	string strA,
	int indexA,
	string strB,
	int indexB,
	int length
)
<TemplateAttribute> _
Public Shared Function Compare ( _
	strA As String, _
	indexA As Integer, _
	strB As String, _
	indexB As Integer, _
	length As Integer _
) As Integer
[TemplateAttribute]
public:
static int^ Compare(
	String^ strA, 
	int^ indexA, 
	String^ strB, 
	int^ indexB, 
	int^ length
)

Parameters

strA
Type: System..::..String
The first string to use in the comparison.
indexA
Type: System..::..Int32
The position of the substring within strA.
strB
Type: System..::..String
The second string to use in the comparison.
indexB
Type: System..::..Int32
The position of the substring within strB.
length
Type: System..::..Int32
The maximum number of characters in the substrings to compare.

Return Value

A 32-bit signed integer indicating the lexical relationship between the two comparands.Value Condition Less than zero The substring in strA precedes the substring in strB in the sort order. Zero The substrings occur in the same position in the sort order, or length is zero. Greater than zero The substring in strA follows the substring in strB in the sort order.

Exceptions


ExceptionCondition
System..::..ArgumentOutOfRangeExceptionindexA is greater than strA.Length.-or- indexB is greater than strB.Length.-or- indexA, indexB, or length is negative. -or-Either indexA or indexB is null, and length is greater than zero.