This repository provides a single-header C/C++ library (utf8.h) for UTF-8 string manipulation. It implements a comprehensive set of functions mirroring the standard C string.h and strings.h APIs, but operating on UTF-8 encoded strings with codepoint-aware semantics. The library includes functions for length calculation (utf8len), comparison (utf8cmp, utf8casecmp), concatenation (utf8cat), searching (utf8chr, utf8str, utf8casestr), validation (utf8valid, utf8makevalid), case conversion (utf8lwr, utf8upr), and codepoint extraction (utf8codepoint, utf8rcodepoint). It supports C++14 constexpr for many functions and C++20 char8_t. The code is highly portable, tested across multiple compilers (gcc, clang, MSVC, tcc) and platforms (Linux, macOS, Windows), and includes extensive unit tests covering edge cases like invalid sequences, truncated strings, and case mapping for Latin, Greek, and Cyrillic scripts. The library is self-contained with no external dependencies beyond the standard C library.
Twine is a PHP string manipulation library providing an expressive, fluent object-oriented interface. It wraps a string in a `Str` object and offers methods for transformation, encoding, encryption, hashing, comparison, case conversion, and more. The library leverages PHP 8.1 features like enums for configuration and relies on the Multibyte String extension for Unicode support and OpenSSL for encryption. The architecture is a monolith single class using traits to organize functionality, with factory methods and a global helper for easy instantiation. The primary entry point is the `PHLAK\Twine\Str` class, which can be created via constructor, static `make()`, or the `str()` helper. Data flows are method chaining; most methods return new `Str` instances to maintain immutability. External dependencies are limited to PHP extensions (mbstring, openssl). The test suite is comprehensive with high coverage. The library is well-documented with a VitePress documentation site.