TechTalk Genome v4.2

NullableString.Compare Method (NullableString, Int32, NullableString, Int32, Int32, Boolean, CultureInfo)

Compares substrings of the two specified NullableString structures.

public static int Compare(
   NullableString a,
   int indexA,
   NullableString b,
   int indexB,
   int length,
   bool ignoreCase,
   CultureInfo culture
);

Parameters

a
A NullableString structure.
indexA
The position of the substring within a.
b
A NullableString structure.
indexB
The position of the substring within b.
length
The maximum number of characters in the substrings to compare.
ignoreCase
A bool indicating a case-sensitive or insensitive comparison. (true indicates a case-insensitive comparison).
culture
A CultureInfo object that supplies culture-specific formatting information.

Return Value

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

ValueDescription
A negative integer the substring in a is less than the substring in b.
Zero the substring in a is equal to the substring in b.
A positive integer the substring in a is greater than the substring in b.

-or-

b is Null.

Remarks

culture specifies a CultureInfo object, which provides culture-specific information that can affect the comparison. indexA and indexB are zero-based. length cannot be negative. If length is zero, then zero is returned. The number of characters compared is the lesser of the length of a less indexA, the length of b less indexB, and length. By definition, any NullableString, including the Empty string, compares greater than Null; and two Null compare equal to each other. The two NullableString are compared on a character-by-character basis.

Exceptions

Exception TypeCondition
ArgumentNullExceptionculture is a null reference (Nothing in Visual Basic).
ArgumentOutOfRangeException The sum of indexA and length is greater than a.

-or-

The sum of indexB and length is greater than b.

-or-

indexA, indexB or length is negative.

Requirements

Namespace: TechTalk.Genome.NullableTypes

Assembly: TechTalk.Genome (in TechTalk.Genome.dll)

Version: 4.2.4.4

Editions: Professional, Evaluation, Express

See Also

NullableString Class | TechTalk.Genome.NullableTypes Namespace | NullableString.Compare Overload List