C Collections

cstring · Section 3

cstring_compare

cstring_compare - compare the string to a C string

C Collections (libccollections, -lccollections)

#include <ccollections/cstring.h>
 
int cstring_compare(cstr s, const char *str);

This function compares the content of s with the null-terminated C string
str, the same way strcmp() does.

s     String to compare
str   C string to compare against

A negative value if s < str
Zero if s == str
A positive value if s > str
1 if str is NULL, since the library treats any string that is not NULL
as greater than NULL

Asserts if s is NULL

cstring_equals(3), cstring_starts_with(3), cstring_ends_with(3)