utf8_construct_from_char Subroutine

public subroutine utf8_construct_from_char(utf8, str, escape)

Arguments

TypeIntentOptionalAttributesName
type(utf8_string), intent(out) :: utf8
character(kind=c_char,len=*), intent(in) :: str
logical, intent(in), optional :: escape

Contents


Source Code

    subroutine utf8_construct_from_char(utf8, str, escape)
        type(utf8_string), intent(out) :: utf8
        character(len=*, kind=c_char), intent(in) :: str
        logical, optional, intent(in) :: escape
            !! if parse unicode escape sequence \uXXXX, default is .false.
        logical :: parse

        if (present(escape)) then
            parse = escape
        else
            parse = .false.
        end if

        if (parse) then
            ! to be implemented
            allocate (utf8%str, source=str)
        else
            allocate (utf8%str, source=str)
        end if

    end subroutine utf8_construct_from_char