sheredom / utf8.h

📚 single header utf8 string functions for C and C++
The Unlicense
1.73k stars 126 forks source link

Added utf8islower, utf8isupper, utf8lwr, utf8upr #29

Closed codecat closed 8 years ago

codecat commented 8 years ago

As discussed earlier in #25, I didn't mark these as "complete" in the readme because they really only cover the A-Za-z range. utf8islower is dumb and only returns 0 for every codepoint in the A-Z range.

The upside is that we can use these functions on any utf-8 string or codepoint and they will include any ascii characters.

Thoughts?

sheredom commented 8 years ago

I think all the ints need to become longs, but apart from that the code is great thanks!

sheredom commented 8 years ago

The closed issue #10 gave some justification for int -> long.

codecat commented 8 years ago

On which compilers is it 16 bit? There were other places where codepoints were passed as ints.

On gcc 64 bit, long is a 64 bit integer. How about using stdint.h so int32_t can be used instead?

sheredom commented 8 years ago

@angelog I had some notion to support VS11 which didn't have stdint, but we could do better than long aye.

I have code in utest.h that does;

#if defined(_MSC_VER)
#define int64_t __int64
#define uint64_t unsigned __int64
#else
#include <stdint.h>
#endif

We could bring that over and make them 32 instead of 64?

codecat commented 8 years ago

I like that idea! I've added it to the PR.