| David Frank 2004-06-10, 3:58 pm |
| Will my S2P function below provide varying string support
equivalent to whats in the F2003 standard but with much less
overhead (faster) in its execution?
! ----------------------------
program f2003_simple_varying_string ! using string pointer
character(:),pointer :: string
string => s2p("The quick brown fox ")
write (*,*) trim(string), len(string) ! len dynamically changes
string => s2p("jumps over the lazy dog's back.")
write (*,*) trim(string), len(string) ! len dynamically changes
stop
contains
function s2p(string) result (out)
character(*),intent(in) :: string
character(:),pointer :: out
deallocate (out)
allocate (character(len(string)) :: out)
out = string
end function
end program
Varying string output ???
The quick brown fox 31
jumps over the lazy dog's back. 32
|