tetengo 1.8.1
A multipurpose library set
|
A grapheme splitter. More...
#include <grapheme_splitter.hpp>
Public Member Functions | |
grapheme_splitter (const std::locale &locale_=std::locale{ "" }) | |
Creates a grapheme splitter. | |
virtual | ~grapheme_splitter () |
Destroys the grapheme splitter. | |
std::vector< grapheme > | split (const std::string_view &string_) const |
Split a string to graphemes. | |
A grapheme splitter.
|
explicit |
Creates a grapheme splitter.
locale_ | A locale. |
std::vector< grapheme > tetengo::text::grapheme_splitter::split | ( | const std::string_view & | string_ | ) | const |
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.
string_ | A string. |
std::invalid_argument | When string_ is not in valid UTF-8. |