SS8_CMP(3)                       Ssstr Manual                       SS8_CMP(3)



NAME
       ss8_cmp,  ss8_cmp_cstr,  ss8_cmp_bytes, ss8_cmp_ch - compare ssstr byte
       string with string or character

SYNOPSIS
       #include <ss8str.h>

       int ss8_cmp(ss8str const *lhs, ss8str const *rhs);
       int ss8_cmp_cstr(ss8str const *lhs, char const *rhs);
       int ss8_cmp_bytes(ss8str const *lhs, char const *rhs,
                         size_t rhslen);
       int ss8_cmp_ch(ss8str const *lhs, char rhs);

DESCRIPTION
       ss8_cmp() compares the ss8str at lhs with the ss8str at rhs.   Behavior
       is undefined unless both lhs and rhs point to valid ss8str objects.

       ss8_cmp_cstr() compares the ss8str at lhs with the null-terminated byte
       string rhs.  Behavior is undefined unless lhs points to a valid  ss8str
       object and rhs is a null-terminated byte string.

       ss8_cmp_bytes()  compares  the  ss8str  at  lhs with the byte string of
       length rhslen located at rhs.  Behavior is undefined unless lhs  points
       to  a valid ss8str object and rhs is not NULL and points to an array of
       at least rhslen bytes.

       ss8_cmp_ch() compares the ss8str at lhs with the byte string consisting
       of  the  single byte rhs.  Behavior is undefined unless lhs points to a
       valid ss8str object.

RETURN VALUE
       All 4 functions return a negative, zero,  or  positive  value,  respec‐
       tively,  if lhs is less than, equal to, or greater than rhs, in a byte-
       wise lexicographical comparison.

NOTES
       The byte-wise lexicographical comparison performed by  these  functions
       does not take into account the encoding of the strings.  If the strings
       are UTF-8-encoded, the comparison will be equivalent to  a  code-point-
       wise lexicographical comparison, but will not take into account canoni‐
       cal equivalents if the strings are not normalized ahead of time.

SEE ALSO
       ss8_contains(3), ss8_ends_with(3),  ss8_equals(3),  ss8_starts_with(3),
       ssstr(7)



SSSTR                             2023-12-30                        SS8_CMP(3)