format_key Function

private pure function format_key(key)

Takes a given key and formats it in a consistent style. Currently that style is left justified in a character variable of minimum length key_align_width.

Arguments

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

Return Value character(len=:), allocatable


Contents

Source Code


Source Code

  pure function format_key(key)
    implicit none
    character(len=:), allocatable :: format_key
    character(len=*), intent(in) :: key
    integer :: length
    length = max(key_align_width, len_trim(adjustl(key)))
    allocate(character(len=length)::format_key)
    write(format_key, '(A)') trim(adjustl(key))
  end function format_key