strip_nml Function

private pure function strip_nml(name) result(out)

Drop a trailing _nml suffix (namelist files spell groups &<name>_nml; the schema stores the bare <name>).

Arguments

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

Return Value character(len=:), allocatable


Calls

proc~~strip_nml~~CallsGraph proc~strip_nml strip_nml proc~lower lower proc~strip_nml->proc~lower

Called by

proc~~strip_nml~~CalledByGraph proc~strip_nml strip_nml proc~dispatch_group dispatch_group proc~dispatch_group->proc~strip_nml proc~schema_find_group nml_schema_t%schema_find_group proc~dispatch_group->proc~schema_find_group proc~schema_is_external nml_schema_t%schema_is_external proc~dispatch_group->proc~schema_is_external proc~schema_find_group->proc~strip_nml proc~schema_is_external->proc~strip_nml proc~parse_from_lines parse_from_lines proc~parse_from_lines->proc~dispatch_group proc~parse_file parse_file proc~parse_file->proc~parse_from_lines proc~schema_parse_lines nml_schema_t%schema_parse_lines proc~schema_parse_lines->proc~parse_from_lines proc~read_config_from_string_impl read_config_from_string_impl proc~read_config_from_string_impl->proc~schema_parse_lines proc~schema_parse nml_schema_t%schema_parse proc~schema_parse->proc~parse_file proc~read_config_from_string read_config_from_string proc~read_config_from_string->proc~read_config_from_string_impl proc~read_config_impl read_config_impl proc~read_config_impl->proc~schema_parse

Variables

Type Visibility Attributes Name Initial
integer, private :: n

Source Code

   pure function strip_nml(name) result(out)
      !! Drop a trailing `_nml` suffix (namelist files spell groups
      !! `&<name>_nml`; the schema stores the bare `<name>`).
      character(len=*), intent(in) :: name
      character(len=:), allocatable :: out
      integer :: n
      n = len_trim(name)
      if (n > 4) then
         if (lower(name(n - 3:n)) == "_nml") then
            out = name(1:n - 4)
            return
         end if
      end if
      out = trim(name)
   end function strip_nml