Unicode.utf8FindPrevChar

Given a position p with a UTF-8 encoded string str, find the start of the previous UTF-8 character starting before p. Returns NULL if no UTF-8 characters are present in str before p.

p does not have to be at the beginning of a UTF-8 character. No check is made to see if the character found is actually valid other than it starts with an appropriate byte.

struct Unicode
static
string
utf8FindPrevChar
(
string str
,
string p
)

Parameters

str string

pointer to the beginning of a UTF-8 encoded string

p string

pointer to some position within str

Return Value

Type: string

a pointer to the found character or NULL.