https://github.com/grqphical/better-string
A single-header C99 library that provides a better string implementation
https://github.com/grqphical/better-string
c c99 library single-header-library string
Last synced: 3 months ago
JSON representation
A single-header C99 library that provides a better string implementation
- Host: GitHub
- URL: https://github.com/grqphical/better-string
- Owner: grqphical
- License: mit
- Created: 2026-03-21T17:39:16.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-03-21T23:45:01.000Z (4 months ago)
- Last Synced: 2026-03-22T12:45:27.898Z (4 months ago)
- Topics: c, c99, library, single-header-library, string
- Language: C
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Better String
[](https://github.com/grqphical/better-string/actions/workflows/tests.yml)
A single header C99 library that creates a better implementation of strings.
## Usage
Clone `better_string.h` into your project and include it like so:
```c
#define BETTER_STRING_IMPLEMENTATION
#include "better_string.h"
```
To convert C style strings to better_strings, use the `bs()` macro:
```c
bs_string str = bs("Hello, World!");
```
To convert a better string back to a C style string, use the `cstr()` macro:
```c
const char* c_str = cstr(str);
```
The header also provides utility functions to make working with these strings easier, you can read more about these in the project's wiki or in the documentation in the
header file itself.
## Features/Roadmap
- [x] Converstion to and from C style strings
- [x] `strlen()` equivalent
- [x] Concatenating strings together
- [x] Getting individual characters from better strings
- [x] Getting the index/pointer to a certain character in a string
- [x] String slicing
- [x] Find and replace substrings
- [x] String comparison
- [x] Substring Deletion
- [ ] Splitting by delimiter
- [ ] Finding all instances of substrings
- [ ] `malloc()`-less version
## License
Better String is licensed under the [MIT License](LICENSE)