starts_with Function

public pure function starts_with(s, prefix) result(ok)

Check whether a string begins with a given prefix.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: s
character(len=*), intent(in) :: prefix

Return Value logical


Called by

proc~~starts_with~2~~CalledByGraph proc~starts_with~2 starts_with proc~build_child_command build_child_command proc~build_child_command->proc~starts_with~2 proc~parse_restart_flags parse_restart_flags proc~parse_restart_flags->proc~starts_with~2 proc~maybe_supervise maybe_supervise proc~maybe_supervise->proc~parse_restart_flags proc~supervisor_loop supervisor_loop proc~maybe_supervise->proc~supervisor_loop proc~supervisor_loop->proc~build_child_command

Source Code

   pure logical function starts_with(s, prefix) result(ok)
      character(len=*), intent(in) :: s, prefix
      integer :: n
      n = len_trim(prefix)
      if (n <= 0) then
         ok = .true.
      else if (len_trim(s) < n) then
         ok = .false.
      else
         ok = (s(1:n) == prefix(1:n))
      end if
   end function starts_with