110,533
社区成员
发帖
与我相关
我的任务
分享
//
// Summary:
// Compares two specified System.String objects using the specified comparison
// options and culture-specific information to influence the comparison, and
// returns an integer that indicates the relationship of the two strings to
// each other in the sort order.
//
// Parameters:
// strA:
// The first string.
//
// strB:
// The second string.
//
// culture:
// The culture that supplies culture-specific comparison information.
//
// options:
// Options to use when performing the comparison (such as ignoring case or symbols).
//
// Returns:
// A 32-bit signed integer that indicates the lexical relationship between strA
// and strB, as shown in the following table Value Condition Less than zero
// strA is less than strB. Zero strA equals strB. Greater than zero strA is
// greater than strB.
//
// Exceptions:
// System.ArgumentException:
// options is not a System.Globalization.CompareOptions value.
//
// System.ArgumentNullException:
// culture is null.
public static int Compare(string strA, string strB, CultureInfo culture, CompareOptions options);
//
// Summary:
// Compares substrings of two specified System.String objects using the specified
// comparison options and culture-specific information to influence the comparison,
// and returns an integer that indicates the relationship of the two substrings
// to each other in the sort order.
//
// Parameters:
// strA:
// The first string.
//
// indexA:
// The starting position of the substring within strA.
//
// strB:
// The second string.
//
// indexB:
// The starting position of the substring within strB.
//
// length:
// The maximum number of characters in the substrings to compare.
//
// culture:
// The culture that supplies culture-specific comparison information.
//
// options:
// Options to use when performing the comparison (such as ignoring case or symbols).
//
// Returns:
// An integer that indicates the lexical relationship between the two substrings,
// as shown in the following table. Value Condition Less than zero The substring
// in strA is less than the substring in strB. Zero The substrings are equal
// or length is zero. Greater than zero The substring in strA is greater than
// the substring in strB.
//
// Exceptions:
// System.ArgumentException:
// options is not a System.Globalization.CompareOptions value.
//
// System.ArgumentOutOfRangeException:
// indexA is greater than strA.Length. -or- indexB is greater than strB.Length.
// -or- indexA, indexB, or length is negative. -or- Either strA or strB is
// null, and length is greater than zero.
//
// System.ArgumentNullException:
// culture is null.
public static int Compare(string strA, int indexA, string strB, int indexB, int length, CultureInfo culture, CompareOptions options);