Operators.CompareString(String, String, Boolean) 方法

定義

指定兩個字串時,執行二進位碼或文字字串比較。Performs binary or text string comparison when given two strings.

此 API 支援此產品基礎結構,但無法直接用於程式碼之中。

public:
 static int CompareString(System::String ^ Left, System::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

參數

Left
String

必要。Required. 任何 String 運算式。Any String expression.

Right
String

必要。Required. 任何 String 運算式。Any String expression.

TextCompare
Boolean

必要。Required. True 表示要執行不區分大小寫的字串比較,否則為 FalseTrue to perform a case-insensitive string comparison; otherwise, False.

傳回

Value 條件Condition
-1-1 Left 小於 Right Left is less than Right.
00 Left 等於 Right Left is equal to Right.
11 Left 大於 Right Left is greater than Right.
.

備註

這個類別支援 Visual Basic 編譯器,而且並非設計直接從程式碼使用。This class supports the Visual Basic compiler and is not intended to be used directly from your code.

當 Visual Basic 相等運算子用來比較兩個字串時,它會將字串傳遞給 CompareString 方法,並將 TextCompare 引數的值 FalseWhen 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. 這會根據Option Compare語句的值,執行序數或根據目前文化特性而定的區分大小寫比較。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.

適用於

另請參閱