3 ms·
Libgrapheme will get you there for the most part. It will let you find characters, words, sentences. It’s nice because it returns byte offsets so you can use th
by adestefan 3y ago
Libgrapheme will get you there for the most part. It will let you find characters, words, sentences. It’s nice because it returns byte offsets so you can use them directly for C data structures. I wish there was a way to get the number of characters along with byte offsets which helps with things like line breaking.
https://libs.suckless.org/libgrapheme/ https://libs.suckless.org/libgrapheme/
- vidarh 3y agoYeah, but you've added a dependency, which the author doesn't seem to want. If you're willing to add dependencies there are multiple other options too.
- JonChesterfield 3y agoThank you for this reference. Deriving a freestanding C99 implementation from the standard sounds great. That can probably be rendered as a single source file to drop into a project that otherwise deals only in ascii.