Edit

Share via


Operators.CompareString(String, String, Boolean) Method

Definition

Performs binary or text string comparison when given two strings.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 static int CompareString(System::String ^ Left, System::String ^ Right, bool TextCompare);
public static int CompareString (string Left, string Right, bool TextCompare);
public static int CompareString (string? Left, string? Right, bool TextCompare);
static member CompareString : string * string * bool -> int
Public Shared Function CompareString (Left As String, Right As String, TextCompare As Boolean) As Integer

Parameters

Left
String

Required. Any String expression.

Right
String

Required. Any String expression.

TextCompare
Boolean

Required. True to perform a case-insensitive string comparison; otherwise, False.

Returns

Value Condition
-1 Left is less than Right.
0 Left is equal to Right.
1 Left is greater than Right.

Remarks

This class supports the Visual Basic compiler and is not intended to be used directly from your code.

When the Visual Basic equality operator is used to compare two strings, it passes the strings to the CompareString method along with a value of False for the TextCompare argument. This performs a case-sensitive comparison that is either ordinal or based on the current culture, depending on the value of the Option Compare statement.

Applies to

See also