For an array section with a substring range, each element in the
result is the designated character substring of the corresponding
element of the array section. The rightmost array name or component
name must be of type character.
PROGRAM SUBSTRING
TYPE DERIVED
CHARACTER(10) STRING(5) ! Each structure has 5 strings of 10 chars.
END TYPE DERIVED
TYPE (DERIVED) VAR, ARRAY(3,3) ! A variable and an array of derived type.
VAR%STRING(:)(1:3) = 'abc' ! Assign to chars 1-3 of elements 1-5.
VAR%STRING(3:)(4:6) = '123' ! Assign to chars 4-6 of elements 3-5.
ARRAY(1:3,2)%STRING(3)(5:10) = 'hello'
! Assign to chars 5-10 of the third element in
! ARRAY(1,2)%STRING, ARRAY(2,2)%STRING, and
END ! ARRAY(3,2)%STRING