int_to_string Function

public function int_to_string(i, ipad) result(str)

integer to string with optional zero padding

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: i
integer, intent(in), optional :: ipad

number of digits to pad with zeros

Return Value character(len=:), allocatable


Called by

proc~~int_to_string~~CalledByGraph proc~int_to_string int_to_string proc~generate_mkspk_setup_file generate_mkspk_setup_file proc~generate_mkspk_setup_file->proc~int_to_string proc~generate_pck_file generate_pck_file proc~generate_pck_file->proc~int_to_string proc~get_case_name mission_type%get_case_name proc~get_case_name->proc~int_to_string proc~generate_eclipse_data mission_type%generate_eclipse_data proc~generate_eclipse_data->proc~get_case_name proc~halo_solver_main halo_solver_main proc~halo_solver_main->proc~generate_mkspk_setup_file proc~halo_solver_main->proc~generate_pck_file proc~halo_solver_main->proc~get_case_name proc~halo_solver_main->proc~generate_eclipse_data proc~plot_trajectory mission_type%plot_trajectory proc~halo_solver_main->proc~plot_trajectory proc~write_optvars_to_file mission_type%write_optvars_to_file proc~halo_solver_main->proc~write_optvars_to_file proc~plot_trajectory->proc~get_case_name proc~write_optvars_to_file->proc~get_case_name

Source Code

    function int_to_string(i,ipad) result(str)
    implicit none
    integer,intent(in) :: i
    character(len=:),allocatable :: str
    integer,intent(in),optional :: ipad !! number of digits to pad with zeros
    character(len=100) :: istr
    integer :: istat
    write(istr,'(I100)',iostat=istat) i
    if (istat==0) then
        str = trim(adjustl(istr))
        if (present(ipad)) then
            if (len(str)<ipad) then
                str = repeat('0',ipad-len(str))//str
            end if
        end if
    else
        str ='****'
    end if

    end function int_to_string