Provides utilities for working with the UTF-8 encoding.
More...
|
| bool | IsValid (std::string_view str) |
| | Checks if string contains valid UTF-8 encoding.
|
| std::size_t | GetSize (std::string_view str, std::size_t pos=0) |
| | Gets size of UTF-8 character at position.
|
| char32_t | Decode (std::string_view str, std::size_t pos=0) |
| | Decodes UTF-8 character to Unicode code point.
|
| std::string | Encode (char32_t codepoint) |
| | Encodes Unicode code point to UTF-8.
|
| bool | IsRightToLeft (char32_t codepoint) |
| | Checks if a Unicode code point belongs to a right-to-left script or has RTL directionality.
|
| bool | IsASCII (std::string_view str) |
| | Checks if a string contains only characters from the basic ASCII set.
|
Provides utilities for working with the UTF-8 encoding.
◆ Decode()
| char32_t nnl::utl::utf8::Decode |
( |
std::string_view | str, |
|
|
std::size_t | pos = 0 ) |
Decodes UTF-8 character to Unicode code point.
- Parameters
-
| str | UTF-8 string |
| pos | Position in string |
- Returns
- Unicode code point
◆ Encode()
| std::string nnl::utl::utf8::Encode |
( |
char32_t | codepoint | ) |
|
Encodes Unicode code point to UTF-8.
- Parameters
-
| codepoint | Unicode code point |
- Returns
- UTF-8 encoded string
◆ GetSize()
| std::size_t nnl::utl::utf8::GetSize |
( |
std::string_view | str, |
|
|
std::size_t | pos = 0 ) |
Gets size of UTF-8 character at position.
- Parameters
-
| str | UTF-8 string |
| pos | Position in string |
- Returns
- Size in bytes of UTF-8 character (1-4)
◆ IsASCII()
| bool nnl::utl::utf8::IsASCII |
( |
std::string_view | str | ) |
|
Checks if a string contains only characters from the basic ASCII set.
- Parameters
-
- Returns
- true if all characters are ASCII;
◆ IsRightToLeft()
| bool nnl::utl::utf8::IsRightToLeft |
( |
char32_t | codepoint | ) |
|
Checks if a Unicode code point belongs to a right-to-left script or has RTL directionality.
- Parameters
-
| codepoint | Unicode code point |
- Returns
- true if RTL character, false otherwise
◆ IsValid()
| bool nnl::utl::utf8::IsValid |
( |
std::string_view | str | ) |
|
Checks if string contains valid UTF-8 encoding.
- Parameters
-
- Returns
- true if valid UTF-8, false otherwise