split_string Function

public function split_string(input_string, separator) result(output_string_vec)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: input_string
character(len=1), intent(in) :: separator

Return Value type(StringVector)


Calls

proc~~split_string~~CallsGraph proc~split_string split_string push_back push_back proc~split_string->push_back

Called by

proc~~split_string~~CalledByGraph proc~split_string split_string proc~process_command_line~3 regrid_support%process_command_line proc~process_command_line~3->proc~split_string proc~main~2 main proc~main~2->proc~process_command_line~3 program~regrid_util Regrid_Util program~regrid_util->proc~main~2

Source Code

    function split_string(input_string,separator) result(output_string_vec)
       character(len=*), intent(in) :: input_string
       character(len=1), intent(in) :: separator
       type(StringVector)  :: output_string_vec
       character(len=:), allocatable :: tstring
       integer :: i

       tstring = input_string
       i = 1
       do while(i /=0)
          i = index(tstring,separator)
          if (i > 0) then
             call output_string_vec%push_back(tstring(1:i-1))
             tstring = tstring(i+1:)
          else
             call output_string_vec%push_back(trim(tstring))
          end if
       enddo
    end function split_string