Hunny Software Library Reference

ByteString.Compare Method (ByteString, ByteString, Boolean)

Compares two byte strings, with case-insensitive option.

[Visual Basic]
Overloads Public Shared Function Compare( _
   ByVal str1 As ByteString, _
   ByVal str2 As ByteString, _
   ByVal ignoreCase As Boolean _
) As Integer
[C#]
public static int Compare(
   ByteString str1,
   ByteString str2,
   bool ignoreCase
);

Parameters

str1
first byte string
str2
second byte string
ignoreCase
if true, comparison is case-insensitive

Return Value

negative value if the first byte string precedes the second in lexical ordering;
positive value if the first byte string follows the second in lexical ordering;
zero otherwise

Remarks

If ignoreCase is true, the result is equivalent to performing a case-sensitive comparison after converting the uppercase ASCII letters A-Z in both byte strings to lowercase.

This method is frequently used with ignoreCase true to compare a byte string to a MIME "keyword", such as "Content-Type", where the byte string's content is known to be ASCII characters.

null is a valid argument that always precedes a byte string in the lexical ordering (that is, it's "less than" a byte string).

See Also

ByteString Class | Hunny.Base Namespace | ByteString.Compare Overload List