SSSTR(7) Ssstr Manual SSSTR(7)
NAME
ssstr, ss8str - short-string-optimized byte string routines
SYNOPSIS
#include <ss8str.h>
DESCRIPTION
ssstr is a header-only library for representing and manipulating byte
strings.
String representation
Strings are represented by the opaque type ss8str, which is suitable
for use as a regular automatic (stack) variable, or as a member of a
larger data structure. (It is 32 bytes on 64-bit platforms and 16
bytes on 32-bit platforms.)
When the string is small, it is stored directly in the ss8str object;
otherwise, dynamic (heap) storage is allocated to store the string.
The ss8str stores the length of the string explicitly, allowing the
handling of strings that contain embedded null bytes in addition to
more efficient operations.
Objects of type ss8str must be initialized before use and destroyed af‐
ter use, exactly once each. See ss8_init(3) and ss8_destroy(3).
FUNCTIONS
Initialization and cleanup
ss8_init(3), ss8_init_copy(3), ss8_init_move(3), ss8_init_move_de‐
stroy(3), ss8_destroy(3), and variants of ss8_init_copy with _cstr,
_bytes, _ch, or _ch_n
Basic string operations
ss8_clear(3), ss8_is_empty(3), ss8_len(3)
Copying and assigning strings
ss8_copy(3), ss8_init_copy(3), and their variants with _cstr, _bytes,
_ch, or _ch_n
Moving strings
ss8_move(3), ss8_move_destroy(3), ss8_init_move(3), ss8_init_move_de‐
stroy(3), ss8_swap(3)
Passing ss8str to C string functions
ss8_cstr(3), ss8_cstr_suffix(3)
Using ss8str as the destination for functions producing C strings
ss8_mutable_cstr(3), ss8_mutable_cstr_suffix(3), ss8_set_len(3),
ss8_set_len_to_cstrlen(3), ss8_grow_len(3)
Converting from standard C strings and byte buffers
ss8_copy_cstr(3), ss8_copy_bytes(3), ss8_init_copy_cstr(3),
ss8_init_copy_bytes(3)
Converting to standard C strings and byte buffers
ss8_copy_to_cstr(3), ss8_copy_to_bytes(3)
Accessing single bytes in strings
ss8_at(3), ss8_front(3), ss8_back(3), ss8_set_at(3), ss8_set_front(3),
ss8_set_back(3)
Concatenating strings
ss8_cat(3) and its variants with _cstr, _bytes, _ch, or _ch_n
Managing buffer capacity
ss8_capacity(3), ss8_reserve(3), ss8_shrink_to_fit(3)
Getting substrings
ss8_copy_substr(3), ss8_substr_inplace(3)
Inserting, replacing, and erasing substrings
ss8_insert(3), ss8_replace(3), and their variants with _cstr, _bytes,
_ch, or _ch_n; ss8_erase(3)
Comparing strings
ss8_cmp(3), ss8_equals(3), ss8_contains(3), ss8_starts_with(3),
ss8_ends_with(3), and their variants with _cstr, _bytes, or _ch
Searching for strings
ss8_find(3), ss8_rfind(3), and their variants with _cstr, _bytes, _ch,
or _not_ch
Searching for characters
ss8_find_first_of(3), ss8_find_first_not_of(3), ss8_find_last_of(3),
ss8_find_last_not_of(3), and their variants with _cstr or _bytes
Trimming certain characters from the ends
ss8_strip(3), ss8_lstrip(3), ss8_rstrip(3), and their variants with
_cstr, _bytes, or _ch
Formatting strings
ss8_sprintf(3), ss8_cat_sprintf(3), and their variants with _snprintf,
_vsprintf, or _vsnprintf
SEE ALSO
bstring(3), string(3)
SSSTR 2023-12-30 SSSTR(7)