🧵 str
Painfully common string utilities for C
Loading...
Searching...
No Matches
🧵 str

Common string utilities for C I'm sick of rewriting:

  • Utilities for string "slices" (also known as "views" or "spans"), which are a pointer + length. Useful for substring references.
  • strzcat() and strzcpy(), sane alternatives to strcat() and strcpy().
  • Polyfill implementations for strdup() and strndup()

None of these are tested, optimized, or otherwise fit for use.

Building

The recommended way to use str is to compile the source files directly into your project. If your project uses git, you can add str as a git submodule.

If you prefer to link against a static library instead, make release will produce one.

# Compile static library with optimizations
make release
# Compile static library with debug information
make debug
# Generate Doxygen documentation (html & man pages)
make docs
# Run tests
make test