Compartilhar via


String.Compare Method

Compares two specified String objects with one another.

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

Syntax

[MethodImplAttribute]
public static int Compare (
         string strA,
         string strB
)

Parameters

  • strA
    The first String object you want to compare.
  • strB
    The second String object you want to compare.

Return Value

A 32-bit signed integer that indicates the lexical relationship between the two comparands.

Value Meaning
Less than 0 (zero) strA is less than strB.
0 (zero) strA equals strB.
Greater than 0 (zero) strA is greater than strB.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, 4.1, and 4.2.

See Also

Reference

String Class
String Members
System Namespace