tetengo 1.8.1
A multipurpose library set
|
A grapheme splitter. More...
#include <stddef.h>
Go to the source code of this file.
Classes | |
struct | tetengo_text_grapheme_tag |
A grapheme. More... | |
Typedefs | |
typedef struct tetengo_text_grapheme_tag | tetengo_text_grapheme_t |
A grapheme. | |
Functions | |
tetengo_text_graphemeSplitter_t * | tetengo_text_graphemeSplitter_create () |
Creates a grapheme splitter. | |
void | tetengo_text_graphemeSplitter_destroy (const tetengo_text_graphemeSplitter_t *p_grapheme_splitter) |
Destroys a grapheme splitter. | |
size_t | tetengo_text_graphemeSplitter_split (const tetengo_text_graphemeSplitter_t *p_grapheme_splitter, const char *string, tetengo_text_grapheme_t *p_graphemes) |
Split a string to graphemes. | |
A grapheme splitter.
Copyright (C) 2019-2023 kaoru https://www.tetengo.org/
tetengo_text_graphemeSplitter_t * tetengo_text_graphemeSplitter_create | ( | ) |
Creates a grapheme splitter.
Call setlocale(LC_CTYPE, [your locale]) before calling this function. The locale affects the result of the grapheme splitter.
void tetengo_text_graphemeSplitter_destroy | ( | const tetengo_text_graphemeSplitter_t * | p_grapheme_splitter | ) |
Destroys a grapheme splitter.
p_grapheme_splitter | A pointer to a grapheme splitter. |
size_t tetengo_text_graphemeSplitter_split | ( | const tetengo_text_graphemeSplitter_t * | p_grapheme_splitter, |
const char * | string, | ||
tetengo_text_grapheme_t * | p_graphemes | ||
) |
Split a string to graphemes.
For emoji defined as "neutral" width in the Unicode standard, this function returns a character width of 2 in the East Asian (Chinese, Japanese or Korean) locale, or 1 in the other locale.
The returned graphemes include a sentinel at the tail. Its offset is the length of the string and its width is 0.
p_grapheme_splitter | A pointer to a grapheme splitter. |
string | A string. |
p_graphemes | The storage for graphemes. Can be NULL. |