count_digits Function

function count_digits(l)

Utility routine to count the number of digits in an integer. Used to construct filenames.

Arguments

Type IntentOptional AttributesName
integer(kind=ip), intent(in) :: l

The integer to count the number of digits in.

Return Value integer(kind=ip)


Called by

proc~~count_digits~~CalledByGraph proc~count_digits count_digits proc~construct_filename construct_filename proc~construct_filename->proc~count_digits proc~read_all_modes read_all_modes proc~read_all_modes->proc~construct_filename interface~read_all_modes read_all_modes interface~read_all_modes->proc~read_all_modes

Contents

Source Code


Source Code

  function count_digits ( l )
  !! Utility routine to count the number of digits in an integer. Used to
  !! construct filenames.

    implicit none

    integer(ip), intent(in) :: l
    !! The integer to count the number of digits in.
    integer(ip) :: count_digits
    integer(ip) :: ltmp

    count_digits = 1
    ltmp = l/10

    count_the_digits: do
      if (ltmp<1) exit count_the_digits
      count_digits = count_digits+1
      ltmp = ltmp/10
    end do count_the_digits
  end function count_digits