SS8_LEN(3) Ssstr Manual SS8_LEN(3)
NAME
ss8_len, ss8_is_empty - query length of ssstr byte string
SYNOPSIS
#include <ss8str.h>
size_t ss8_len(ss8str const *str);
bool ss8_is_empty(ss8str const *str);
DESCRIPTION
ss8_len() queries the length of the ss8str pointed to by str.
ss8_is_empty() tests whether the ss8str pointed to by str is empty,
that is, has a length of zero.
For either function, behavior is undefined unless str points to a valid
ss8str object.
The length of an ss8str is stored explicitly and is not affected by the
byte string it contains. Specifically, if the byte string contains em‐
bedded null bytes, its length will differ from what strlen() would re‐
turn when called on the equivalent string.
RETURN VALUE
ss8_len() returns the length, in bytes, of the string at str, not in‐
cluding the null terminator that would be part of the string when
viewed as a null-terminated byte string. Any embedded null bytes in
the string do not affect the length.
ss8_is_empty() returns true when str has a length of zero; otherwise it
returns false.
SEE ALSO
ss8_capacity(3), ss8_set_len(3), ssstr(7)
SSSTR 2023-12-30 SS8_LEN(3)