strip_char Function

private pure function strip_char(string) result(stripped_string)

Remove leading and trailing whitespace characters.

Arguments

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

Return Value character(len=:), allocatable


Called by

proc~~strip_char~~CalledByGraph proc~strip_char strip_char interface~strip strip interface~strip->proc~strip_char proc~strip_string strip_string interface~strip->proc~strip_string proc~strip_string->interface~strip

Variables

Type Visibility Attributes Name Initial
integer, private :: first
integer, private :: last

Source Code

   pure function strip_char(string) result(stripped_string)
      character(len=*), intent(in) :: string
      character(len=:), allocatable :: stripped_string
      integer :: first, last

      first = verify(string, whitespace)
      if (first == 0) then
         stripped_string = ""
      else
         last = verify(string, whitespace, back=.true.)
         stripped_string = string(first:last)
      end if

   end function strip_char