char_string_pos Function

private elemental function char_string_pos(string, pos) result(character_string)

Return the character sequence represented by the string.

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
integer, intent(in) :: pos

Return Value character(len=1)


Called by

proc~~char_string_pos~~CalledByGraph proc~char_string_pos char_string_pos interface~char char interface~char->proc~char_string_pos

Source Code

elemental function char_string_pos(string, pos) result(character_string)
   type(string_type), intent(in) :: string
   integer, intent(in) :: pos
   character(len=1) :: character_string

   ! See len_trim_string: MERGE would evaluate `string%raw(pos:pos)` even
   ! for an unallocated `raw`, which is a reference to an unallocated
   ! allocatable.
   if (allocated(string%raw)) then
      character_string = string%raw(pos:pos)
   else
      character_string = " "
   end if

end function char_string_pos