Unicode.utf8PointerToOffset

Converts from a pointer to position within a string to a integer character offset.

Since 2.10, this function allows @pos to be before @str, and returns a negative offset in this case.

struct Unicode
static
utf8PointerToOffset
(
string str
,
string pos
)

Parameters

str string

a UTF-8 encoded string

pos string

a pointer to a position within @str

Return Value

Type: glong

the resulting character offset

Meta