This subroutine returns the index of the next UTF-8 character conteined in str
.
This is used to handle strings that may not be encoded by UTF-8.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | str | |||
integer, | intent(in) | :: | curr | |||
integer, | intent(inout) | :: | next | |||
logical, | intent(inout) | :: | is_valid |
pure subroutine next_idxutf8_strict(str, curr, next, is_valid) use :: forgex_parameters_m implicit none character(*), intent(in) :: str integer, intent(in) :: curr integer, intent(inout) :: next logical, intent(inout) :: is_valid integer :: ib, ie ! initialize is_valid = .false. ib = curr ie = idxutf8(str, ib) if (ie /= INVALID_CHAR_INDEX) then is_valid = is_valid_multiple_byte_character(str(ib:ie)) next = ie + 1 else next = curr+1 is_valid = .false. end if end subroutine next_idxutf8_strict