Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Operators.CompareString Method (String, String, Boolean)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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

Performs binary or text string comparison when given two strings.

Namespace:   Microsoft.VisualBasic.CompilerServices
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

public static int CompareString(
	string Left,
	string Right,
	bool TextCompare


Type: System.String

Required. Any String expression.

Type: System.String

Required. Any String expression.

Type: System.Boolean

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

Return Value

Type: System.Int32




Left is less than Right.


Left is equal to Right.


Left is greater than Right.

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 statement.

Universal Windows Platform
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone
Available since 8.1
Return to top
© 2018 Microsoft