aboutsummaryrefslogtreecommitdiff
path: root/char32.h
diff options
context:
space:
mode:
Diffstat (limited to 'char32.h')
-rw-r--r--char32.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/char32.h b/char32.h
index 6a5eb080..dcb412ce 100644
--- a/char32.h
+++ b/char32.h
@@ -20,6 +20,10 @@ static inline int c32cmp(const char32_t *s1, const char32_t *s2) {
return wcscmp((const wchar_t *)s1, (const wchar_t *)s2);
}
+static inline int c32ncmp(const char32_t *s1, const char32_t *s2, size_t n) {
+ return wcsncmp((const wchar_t *)s1, (const wchar_t *)s2, n);
+}
+
static inline char32_t *c32ncpy(char32_t *dst, const char32_t *src, size_t n) {
return (char32_t *)wcsncpy((wchar_t *)dst, (const wchar_t *)src, n);
}
@@ -60,6 +64,10 @@ static inline char32_t toc32upper(char32_t c) {
return (char32_t)towupper((wint_t)c);
}
+static inline bool isc32upper(char32_t c32) {
+ return iswupper((wint_t)c32);
+}
+
static inline bool isc32space(char32_t c32) {
return iswspace((wint_t)c32);
}
@@ -72,6 +80,13 @@ static inline bool isc32graph(char32_t c32) {
return iswgraph((wint_t)c32);
}
+static inline bool hasc32upper(const char32_t *s) {
+ for (int i = 0; s[i] != '\0'; i++) {
+ if (isc32upper(s[i])) return true;
+ }
+ return false;
+}
+
static inline int c32width(char32_t c) {
#if defined(FOOT_GRAPHEME_CLUSTERING)
return utf8proc_charwidth((utf8proc_int32_t)c);