C Collections

cstring · Section 3

cstring_at

cstring_at - return the character at a given index

C Collections (libccollections, -lccollections)

#include <ccollections/cstring.h>
 
char cstring_at(cstr s, size_t idx);

This function returns the character at the zero-based index idx. For an
index that is out of bounds it returns '\0' instead of asserting.

s     String to query
idx   Zero-based character index

The character at idx, or '\0' if idx >= length

Asserts if s is NULL

cstring_c_str(3), cstring_length(3)