cstring · Section 3
cstring_find
NAME
cstring_find - find the first occurrence of a substring
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/cstring.h> size_t cstring_find(cstr s, const char *needle);
DESCRIPTION
This function looks for the first occurrence of needle in the string and returns the zero-based index where it starts.
PARAMETERS
s String to search needle Substring to find
RETURN VALUE
Zero-based index of the first occurrence 0 if needle is an empty string (matches at the start) ccol_invalid_size ((size_t)-1) if needle is not found, or if needle is NULL
NOTES
Asserts if s is NULL
SEE ALSO
cstring_rfind(3), cstring_starts_with(3), cstring_ends_with(3)