This project toward strings module in Fortran stdlib will be of help with such needs in coding.
Interested readers can follow the blogposts by @Aman and reach out to @Aman and mentors for feedback, comments, etc.
Ultimately I do hope Fortran standard will include an intrinsic “string” type - now imagine for a moment it’s called string_t
- that will allow along the lines of the original post:
type(string_t) :: words(3)
..
words = [ 'cat', 'donkey', 'orca' ]
As the many community efforts including with latest stdlib
show, it’s nearly doable as a user derived type now.
But having it part of the standard as an intrinsic type for “strings” can bring immeasurable benefits in terms of ease-of-use, productivity gains, and consistency of code for the poor, persevering practitioners of Fortran, for working with strings is such a basic aspect of any scientific and technical computing; it’s not only about compute-performance in such computing; preprocessing and post-processing of data toward computations where such facilities come into play are also critical to the overall workflow. Wish standard bearers could come to a convergence on this and commission some work, alas that is not the case!