aboutsummaryrefslogtreecommitdiff
path: root/src/fpm_strings.f90
diff options
context:
space:
mode:
authorJoel <5474278+noisegul@users.noreply.github.com>2022-02-12 13:33:36 +0100
committerGitHub <noreply@github.com>2022-02-12 13:33:36 +0100
commit57b5636f5f573f06326fdecd24057a6297a53501 (patch)
tree865413a2144d94507067309dd43e6134495f27b7 /src/fpm_strings.f90
parent68061db6f86951e9b3f3d553c54da728a9982dbd (diff)
downloadfpm-57b5636f5f573f06326fdecd24057a6297a53501.tar.gz
fpm-57b5636f5f573f06326fdecd24057a6297a53501.zip
Ignore hidden source files (#654)
* Add str_begins_with_str function * Add function to test if a single file is hidden * Exclude hidden files when finding source files
Diffstat (limited to 'src/fpm_strings.f90')
-rw-r--r--src/fpm_strings.f9015
1 files changed, 14 insertions, 1 deletions
diff --git a/src/fpm_strings.f90 b/src/fpm_strings.f90
index 4650ebd..aceb01a 100644
--- a/src/fpm_strings.f90
+++ b/src/fpm_strings.f90
@@ -39,7 +39,7 @@ use iso_c_binding, only: c_char, c_ptr, c_int, c_null_char, c_associated, c_f_po
implicit none
private
-public :: f_string, lower, split, str_ends_with, string_t
+public :: f_string, lower, split, str_ends_with, string_t, str_begins_with_str
public :: to_fortran_name, is_fortran_name
public :: string_array_contains, string_cat, len_trim, operator(.in.), fnv_1a
public :: replace, resize, str, join, glob
@@ -115,6 +115,19 @@ pure logical function str_ends_with_any(s, e) result(r)
end function str_ends_with_any
+!> test if a CHARACTER string begins with a specified prefix
+pure logical function str_begins_with_str(s, e) result(r)
+ character(*), intent(in) :: s, e
+ integer :: n1, n2
+ n1 = 1
+ n2 = 1 + len(e)-1
+ if (n2 > len(s)) then
+ r = .false.
+ else
+ r = (s(n1:n2) == e)
+ end if
+end function str_begins_with_str
+
!> return Fortran character variable when given a C-like array of
!! single characters terminated with a C_NULL_CHAR character
function f_string(c_string)