SDK Utf8 API documentation
Namespace: | dmUtf8 |
Include: | #include <dmsdk/dlib/utf8.h> |
FUNCTIONS | |
---|---|
uint32_t NextChar(const char** str) | get next unicode character in utf-8 string. |
uint32_t StrLen(const char* str) | Get number of unicode characters in utf-8 string |
uint32_t ToUtf8(uint16_t chr, char* buf) | Convert a 16-bit unicode character to utf-8 |
uint32_t NextChar(const char** str)
Get next unicode character in utf-8 string. Iteration terminates at '\0' and repeated invocations will return '\0'
PARAMETERS
const char** |
str |
Pointer to string. The pointer value is updated |
RETURNS
uint32_t |
Decoded unicode character |
EXAMPLES
const char* s = "åäöÅÄÖ";
char* cursor = s;
uint32_t codepoint = 0;
while (codepoint = dmUtf8::NextChar(&cursor))
{
// ...
}
uint32_t StrLen(const char* str)
Get number of unicode characters in utf-8 string
PARAMETERS
const char* |
str |
Utf8 string |
RETURNS
uint32_t |
Number of characters |
EXAMPLES
const char* s = "åäöÅÄÖ";
uint32_t count = dmUtf8::StrLen(s);
uint32_t ToUtf8(uint16_t chr, char* buf)
Convert a 16-bit unicode character to utf-8
PARAMETERS
uint16_t |
chr |
Character to convert |
char* |
buf |
output Buffer (at least 4 bytes) |
RETURNS
uint32_t |
Number of characters in buffer |