return the number of UTF-8 code points
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(utf8_string), | intent(in) | :: | utf8 |
pure function utf8_len(utf8) result(l)
class(utf8_string), intent(in) :: utf8
integer :: l
integer :: i
l = 0; i = 1
do
if (i > len(utf8%str)) exit
i = i + codepoint_num_bytes(cast_byte(utf8%str(i:i)))
l = l + 1
end do
end function utf8_len