diff options
author | LKedward <laurence.kedward@bristol.ac.uk> | 2021-03-11 16:10:59 +0000 |
---|---|---|
committer | LKedward <laurence.kedward@bristol.ac.uk> | 2021-03-15 15:13:19 +0000 |
commit | 2346f7147cbd2d36bb5af7da9a59796cc1fed2d1 (patch) | |
tree | 9e3694717e820e6a000f1fc9751424fded17e839 | |
parent | 0e42c57234e17f74f1f280d86324a2734950a30b (diff) | |
download | fpm-2346f7147cbd2d36bb5af7da9a59796cc1fed2d1.tar.gz fpm-2346f7147cbd2d36bb5af7da9a59796cc1fed2d1.zip |
Add: new_string_t helper fcn
-rw-r--r-- | fpm/src/fpm_strings.f90 | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/fpm/src/fpm_strings.f90 b/fpm/src/fpm_strings.f90 index 7623e43..2e3d69e 100644 --- a/fpm/src/fpm_strings.f90 +++ b/fpm/src/fpm_strings.f90 @@ -3,7 +3,7 @@ use iso_fortran_env, only: int64 implicit none private -public :: f_string, lower, split, str_ends_with, string_t +public :: f_string, lower, split, str_ends_with, new_string_t, string_t public :: string_array_contains, string_cat, len_trim, operator(.in.), fnv_1a public :: replace, resize, str, join, glob @@ -160,6 +160,15 @@ elemental pure function lower(str,begin,end) result (string) end function lower +!> Helper function to generate a new string_t instance +!> (Required due to the allocatable component) +function new_string_t(s) result(string) + character(*), intent(in) :: s + type(string_t) :: string + + string%s = s + +end function new_string_t logical function string_array_contains(search_string,array) ! Check if array of string_t contains a particular string |