StringCompare Method (String, String, Boolean, CultureInfo) |
Compares two specified
String objects, ignoring or honoring their case, and using culture-specific information to influence the comparison, and returns an integer that indicates their relative position in the sort order.
Namespace: SystemAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax public static int Compare(
string strA,
string strB,
bool ignoreCase,
CultureInfo culture
)
Parameters
- strA
- Type: SystemString
The first string to compare. - strB
- Type: SystemString
The second string to compare. - ignoreCase
- Type: SystemBoolean
true to ignore case during the comparison; otherwise, false. - culture
- Type: System.GlobalizationCultureInfo
An object that supplies culture-specific comparison information.
Return Value
Type:
Int32A 32-bit signed integer that indicates the lexical relationship between the two comparands.Value Condition Less than zero
strA is less than
strB. Zero
strA equals
strB. Greater than zero
strA is greater than
strB.
Exceptions See Also