SS8_STARTS_WITH(3) Ssstr Manual SS8_STARTS_WITH(3)
NAME
ss8_starts_with, ss8_starts_with_cstr, ss8_starts_with_bytes,
ss8_starts_with_ch, ss8_ends_with, ss8_ends_with_cstr,
ss8_ends_with_bytes, ss8_ends_with_ch - check if an ssstr byte string
has a prefix or suffix
SYNOPSIS
#include <ss8str.h>
bool ss8_starts_with(ss8str const *str, ss8str const *prefix);
bool ss8_starts_with_cstr(ss8str const *str, char const *prefix);
bool ss8_starts_with_bytes(ss8str const *str,
char const *prefix, size_t prefixlen);
bool ss8_starts_with_ch(ss8str const *str, char ch);
bool ss8_ends_with(ss8str const *str, ss8str const *suffix);
bool ss8_ends_with_cstr(ss8str const *str, char const *suffix);
bool ss8_ends_with_bytes(ss8str const *str, char const *suffix,
size_t suffixlen);
bool ss8_ends_with_ch(ss8str const *str, char ch);
DESCRIPTION
ss8_starts_with() tests whether the ss8str at str contains the prefix
equal to the ss8str at prefix. Behavior is undefined unless both str
and prefix point to valid ss8str objects.
ss8_starts_with_cstr() tests whether the ss8str at str contains the
prefix equal to the null-terminated byte string prefix. Behavior is
undefined unless str points to a valid ss8str object and prefix is a
null-terminated byte string.
ss8_starts_with_bytes() tests whether the ss8str at str contains the
prefix equal to the byte string of length prefixlen located at prefix.
Behavior is undefined unless str points to a valid ss8str object and
prefix is not NULL and points to an array of at least prefixlen bytes.
ss8_starts_with_ch() tests whether the first byte of the ss8str at str
is equal to ch. Behavior is undefined unless str points to a valid
ss8str object.
ss8_ends_with(), ss8_ends_with_cstr(), ss8_ends_with_bytes(), and
ss8_ends_with_ch() are like the corresponding functions with starts in‐
stead of ends in the name, except that they test whether the string
contains the given suffix, rather than prefix.
RETURN VALUE
All 8 functions return true if the prefix or suffix matches; otherwise
they return false.
SEE ALSO
ss8_contains(3), ss8_equals(3), ss8_find(3), ssstr(7)
SSSTR 2023-12-30 SS8_STARTS_WITH(3)