SS8_FIND(3) Ssstr Manual SS8_FIND(3) NAME ss8_find, ss8_find_cstr, ss8_find_bytes, ss8_find_ch, ss8_find_not_ch, ss8_rfind, ss8_rfind_cstr, ss8_rfind_bytes, ss8_rfind_ch, ss8_rfind_not_ch - find a string or character in an ssstr byte string SYNOPSIS #include <ss8str.h> size_t ss8_find(ss8str const *haystack, size_t start, ss8str const *needle); size_t ss8_find_cstr(ss8str const *haystack, size_t start, char const *needle); size_t ss8_find_bytes(ss8str const *haystack, size_t start, char const *needle, size_t needlelen); size_t ss8_find_ch(ss8str const *haystack, size_t start, char needle); size_t ss8_find_not_ch(ss8str const *haystack, size_t start, char needle); size_t ss8_rfind(ss8str const *haystack, size_t start, ss8str const *needle); size_t ss8_rfind_cstr(ss8str const *haystack, size_t start, char const *needle); size_t ss8_rfind_bytes(ss8str const *haystack, size_t start, char const *needle, size_t needlelen); size_t ss8_rfind_ch(ss8str const *haystack, size_t start, char needle); size_t ss8_rfind_not_ch(ss8str const *haystack, size_t start, char needle); DESCRIPTION ss8_find() finds the first occurrence of the substring equal to the ss8str at needle in the ss8str at haystack. Only matches that begin at or after the byte position start are considered. Behavior is undefined unless haystack and needle both point to valid ss8str objects and start is less than or equal to the length of the haystack string. ss8_find_cstr() is like ss8_find() but finds the first occurrence of the null-terminated byte string needle. Behavior is undefined unless haystack points to a valid ss8str object, start is less than or equal to the length of the haystack string, and needle is a null-terminated byte string. ss8_find_bytes() is like ss8_find() but finds the first occurrence of the byte string of length needlelen located at needle. Behavior is un‐ defined unless haystack points to a valid ss8str object, start is less than or equal to the length of the haystack string, and needle is not NULL and points to an array of at least needlelen bytes. ss8_find_ch() is like ss8_find() but finds the first occurrence of the byte needle. Behavior is undefined unless haystack points to a valid ss8str object and start is less than or equal to the length of the haystack string. ss8_find_not_ch() is like ss8_find_ch() except that it finds the first occurrence of a byte that is not equal to needle. ss8_rfind(), ss8_rfind_cstr(), ss8_rfind_bytes(), ss8_rfind_ch(), and ss8_rfind_not_ch() are like the corresponding functions without the r in the name, except that they find the last, rather than first, occur‐ rence of needle. Only matches that begin at or before the byte posi‐ tion start are considered. RETURN VALUE All 10 functions return the position, counting from the beginning of the haystack string, of the first byte of the match. If there is no match, SIZE_MAX is returned. If needle is the empty string, start is returned. SEE ALSO ss8_contains(3), ss8_equals(3), ss8_find_first_of(3), ssstr(7) SSSTR 2023-12-30 SS8_FIND(3)