Namespace: dmUtf8
Language: C++
Type: Defold C++
File: utf8.h
Source: engine/dlib/src/dmsdk/dlib/utf8.h
Include: dmsdk/dlib/utf8.h
Utf8 API documentation
Type: FUNCTION Checks if a codepoint is a breaking whitespace
Parameters
c (uint32_t) - the codepointReturns
result (bool) - true if it’s a breaking whitespaceType: FUNCTION Checks if a codepoint is a whitespace
Parameters
c (uint32_t) - the codepointReturns
result (bool) - true if it’s a whitespaceType: FUNCTION Get next unicode character in utf-8 string. Iteration terminates at ‘\0’ and repeated invocations will return ‘\0’
Parameters
str (const char**) - Pointer to string. The pointer value is updatedReturns
chr (uint32_t) - Decoded unicode characterExamples
const char* s = "åäöÅÄÖ";
char* cursor = s;
uint32_t codepoint = 0;
while (codepoint = dmUtf8::NextChar(&cursor))
{
// ...
}
Type: FUNCTION Get number of unicode characters in utf-8 string
Parameters
str (const char*) - Utf8 stringReturns
length (uint32_t) - Number of charactersExamples
const char* s = "åäöÅÄÖ";
uint32_t count = dmUtf8::StrLen(s);
Type: FUNCTION Convert a 16-bit unicode character to utf-8
Notes
Parameters
chr (uint16_t) - Character to convertbuf (char*) - output Buffer (at least 4 bytes)Returns
length (uint32_t) - Number of characters in buffer