Skip to content

Commit 2346f71

Browse files
committed
Add: new_string_t helper fcn
1 parent 0e42c57 commit 2346f71

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

fpm/src/fpm_strings.f90

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module fpm_strings
33
implicit none
44

55
private
6-
public :: f_string, lower, split, str_ends_with, string_t
6+
public :: f_string, lower, split, str_ends_with, new_string_t, string_t
77
public :: string_array_contains, string_cat, len_trim, operator(.in.), fnv_1a
88
public :: replace, resize, str, join, glob
99

@@ -160,6 +160,15 @@ elemental pure function lower(str,begin,end) result (string)
160160

161161
end function lower
162162

163+
!> Helper function to generate a new string_t instance
164+
!> (Required due to the allocatable component)
165+
function new_string_t(s) result(string)
166+
character(*), intent(in) :: s
167+
type(string_t) :: string
168+
169+
string%s = s
170+
171+
end function new_string_t
163172

164173
logical function string_array_contains(search_string,array)
165174
! Check if array of string_t contains a particular string

0 commit comments

Comments
 (0)