Convert a character into an array of character(1)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | c | Character to convert |
New array of character(1)
function charToArray(c) result(o)
!! Convert a character into an array of character(1)
character(*),intent(in)::c
!! Character to convert
character(1),dimension(:),allocatable::o
!! New array of character(1)
integer::k
o = [character(1)::( c(k:k) , k=1,len(c) )]
end function charToArray