@@ -97,6 +97,7 @@ module stdlib_stringlist_type
9797 interface stringlist_type
9898 module procedure new_stringlist
9999 module procedure new_stringlist_carray
100+ module procedure new_stringlist_sarray
100101 end interface
101102
102103 ! > Version: experimental
@@ -150,9 +151,6 @@ module stdlib_stringlist_type
150151 ! > Returns a new instance of type stringlist
151152 pure function new_stringlist ()
152153 type (stringlist_type) :: new_stringlist
153- type (string_type), dimension (0 ) :: sarray
154-
155- new_stringlist = stringlist_type( sarray )
156154
157155 end function new_stringlist
158156
@@ -172,6 +170,17 @@ pure function new_stringlist_carray( array )
172170
173171 end function new_stringlist_carray
174172
173+ ! > Constructor to convert stringarray to stringlist
174+ ! > Returns a new instance of type stringlist
175+ pure function new_stringlist_sarray ( array )
176+ type (string_type), dimension (:), intent (in ) :: array
177+ type (stringlist_type) :: new_stringlist_sarray
178+
179+ new_stringlist_sarray = stringlist_type()
180+ new_stringlist_sarray% stringarray = array
181+
182+ end function new_stringlist_sarray
183+
175184 ! constructor for stringlist_index_type:
176185
177186 ! > Returns an instance of type 'stringlist_index_type' representing forward index 'idx'
0 commit comments