LogicalStringComparer.Compare Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Compare(String, String) |
Performs a logical comparison between two strings. |
Compare(String, Int32, Int32, String, Int32, Int32) |
Performs a logical comparison between substrings of two strings. |
Compare(String, String)
Performs a logical comparison between two strings.
public override int Compare (string? s1, string? s2);
override this.Compare : string * string -> int
Public Overrides Function Compare (s1 As String, s2 As String) As Integer
Parameters
- s1
- String
The first string to compare.
- s2
- String
The second string to compare.
Returns
A signed integer that indicates the relative values of x and y, as shown in the following table:
Value | Meaning |
---|---|
Less than zero | s1 precedes s2 in the sort order.
|
Zero | s1 occurs in the same position as s2 in the sort order.
|
Greater than zero | s1 follows s2 in the sort order.
|
Applies to
Compare(String, Int32, Int32, String, Int32, Int32)
Performs a logical comparison between substrings of two strings.
public int Compare (string? s1, int start1, int length1, string? s2, int start2, int length2);
override this.Compare : string * int * int * string * int * int -> int
Public Function Compare (s1 As String, start1 As Integer, length1 As Integer, s2 As String, start2 As Integer, length2 As Integer) As Integer
Parameters
- s1
- String
The first string to use in the comparison.
- start1
- Int32
The position of the substring within s1
.
- length1
- Int32
The length of the substring within s1
.
- s2
- String
The second string to use in the comparison.
- start2
- Int32
The position of the substring within s2
.
- length2
- Int32
The length of the substring within s2
.
Returns
A signed integer that indicates the relative values of x and y, as shown in the following table:
Value | Meaning |
---|---|
Less than zero |
The substring in s1 precedes the substring in s2 in the sort order.
|
Zero |
The substring in s1 occurs in the same position as the substring in s2 in the sort order.
|
Greater than zero |
The substring in s1 follows the substring in s2 in the sort order.
|