mirror of
https://github.com/ascii-boxes/boxes.git
synced 2025-02-01 10:29:24 +01:00
Add u32_is_blank() in 'unicode' module
This commit is contained in:
parent
1b71c4fca2
commit
6c40928ed0
@ -77,6 +77,22 @@ int is_empty(const uint32_t *text)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int u32_is_blank(const uint32_t *text)
|
||||||
|
{
|
||||||
|
if (is_empty(text)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const uint32_t *c = text; *c != char_nul; c++) {
|
||||||
|
if (!is_blank(*c)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int is_ascii_printable(const ucs4_t c)
|
int is_ascii_printable(const ucs4_t c)
|
||||||
{
|
{
|
||||||
return c >= 0x20 && c < 0x7f;
|
return c >= 0x20 && c < 0x7f;
|
||||||
|
@ -80,6 +80,16 @@ void set_char_at(uint32_t *text, const size_t idx, const ucs4_t char_to_set);
|
|||||||
int is_empty(const uint32_t *text);
|
int is_empty(const uint32_t *text);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a string consists entirely of blanks.
|
||||||
|
*
|
||||||
|
* @param text the string to check, NULL/empty strings count as blank
|
||||||
|
* @return > 0: the string is blank, empty, or NULL;
|
||||||
|
* == 0: the string contains at least 1 non-blank character
|
||||||
|
*/
|
||||||
|
int u32_is_blank(const uint32_t *text);
|
||||||
|
|
||||||
|
|
||||||
int is_ascii_printable(const ucs4_t c);
|
int is_ascii_printable(const ucs4_t c);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user