helper functions

3

zt2str

is_str_empty

zt_strdup

str_prefix

str_strchr

various string helper functions

    #include <cds/sstr.h>

      str_t zt2str
      char *s

      int is_str_empty
      const str_t *s

      char *zt_strdup
      const char *src

      int str_prefix
      const str_t *a
      const str_t *b

      char *str_strchr
      const str_t *s
      char c

## Description

`zt2str` converts zero terminated string to str_t. It doesn't copy data - both strings use the same buffer!

`is_str_empty` returns 1 if given string is empty (NULL pointer or length < 1 or NULL pointer to string data)

`zt_strdup` duplicates given zero terminated string to another zero terminated string using cds_malloc function

`str_prefix` returns 0 if string `b` is prefix of `a`, nonzero otherwise (deprecated)

`str_strchr` searches for given character. It returns pointer to it in the string or NULL if not found.

## See Also

str_t