utf8nlen

Computes the length of a string, up to the specified length.

Library:LibC
Service:Characters and Strings

Syntax

  #include <utf8.h> 
   
  size_t utf8nlen (
     const utf8_t  *string
     size_t         nbytes);
  

Parameters

string

(IN) Points to the string whose length is to be computed.

nbytes

(IN) Specifies the maximum number of bytes to scan.

Return Values

Returns the number of characters (not bytes) in a UTF-8 string, not including the null terminating character, or nbytes if no null termination character is found in the specified nbytes. If the string is longer that nbytes, the function ignores those bytes.

Remarks

The utf8nlen function accepts a null-terminated, potential UTF-8 string in the current code page and measures it up to either the null terminating character or nbytes, which every occurs first.

See Also