CorString: CompareEx |
Compares substrings of two specified String objects using the specified rules, and returns an integer that indicates their relative position in the sort order.
Public Function CompareEx( ByRef StrA As String, ByVal IndexA As Long, ByRef StrB As String, ByVal IndexB As Long, ByVal Length As Long, Optional ByVal ComparisonType As StringComparison = StringComparison. Ordinal ) As Long
Default: StringComparison . Ordinal
Value | Condition |
---|---|
Less than zero | The substring in the StrA parameter is less than the substring in the StrB parameter. |
Zero | The substrings are equal, or the Length parameter is zero. |
Greater than zero | The substring in StrA is greater than the substring in StrB. |
The substrings to compare start in StrA at IndexA and in StrB at IndexB. Both IndexA and IndexB are zero-based; that is, the first character in StrA and StrB is at position zero, not position one.
Exception | Condition |
---|---|
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 empty, and Length is greater than zero. |
ArgumentException | ComparisonType is not a StringComparison value. |
NotSupportedException | StringComparison is not supported. |