[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'System' (#rtl)

Utf8CodePointLen

Length of an UTF-8 codepoint.

Declaration

Source position: systemh.inc line 1158

function Utf8CodePointLen(

  P: PAnsiChar;

  MaxLookAhead: SizeInt;

  IncludeCombiningDiacriticalMarks: Boolean

):SizeInt;

Description

Utf8CodePointLen returns the length of the UTF-8 codepoint starting at the beginning of P. It will look at at most MaxLookAhead bytes to do create this codepoint. If IncludeCombiningDiacriticalMarks is true, combining diacritical marks trailing the first codepoint (which itself can also be such a mark) will be considered to be part of the codepoint.

If the function returns a value > 0, then this is the number of bytes occupied by the codepoint and, if requested, the trailing combining diacritical marks. If the result = 0, this means that all bytes within the requested MaxLookAhead could be part of a single valid codepoint and, if requested, its trailing diacritical marks, but that the codepoint is incomplete and more bytes need to be looked at. If the result is < 0, then the function determined that the codepoint was invalid after processing the number of bytes equal to the absolute value of the function result.

If IncludeCombiningDiacriticalMarks is True, then

Errors

None.


Documentation generated on: May 14 2021