char_assign_from_utf8 Subroutine

public subroutine char_assign_from_utf8(str, utf8)

Arguments

TypeIntentOptionalAttributesName
character(kind=c_char,len=:), intent(out), allocatable:: str
type(utf8_string), intent(in) :: utf8

Contents

Source Code


Source Code

    subroutine char_assign_from_utf8(str, utf8)
        character(len=:, kind=c_char), allocatable, intent(out) :: str
        type(utf8_string), intent(in) :: utf8

        if (allocated(utf8%str)) then
            allocate (str, source=utf8%str)
        else
            allocate (character(len=0, kind=c_char) :: str)
        end if

    end subroutine char_assign_from_utf8