strz_I1P Function

private elemental function strz_I1P(nz_pad, n) result(str)

The function strz_I1P converts integer to string, prefixing with the right number of zeros. This function achieves casting of integer to string.

Arguments

Type IntentOptional AttributesName
integer(kind=I4P), intent(in), optional :: nz_pad
integer(kind=I1P), intent(in) :: n

Return Value character(len=DI1P)


Called by

proc~~strz_i1p~~CalledByGraph proc~strz_i1p strz_I1P interface~strz strz interface~strz->proc~strz_i1p

Contents

Source Code


Source Code

  elemental function strz_I1P(nz_pad,n) result(str)
  !---------------------------------------------------------------------------------------------------------------------------------
  !!The function strz\_I1P converts integer to string, prefixing with the right number of zeros. This function achieves casting of
  !!integer to string.
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  implicit none
  integer(I4P), intent(IN), optional:: nz_pad ! Number of zeros padding.
  integer(I1P), intent(IN)::           n      ! Integer to be converted.
  character(DI1P)::                    str    ! Returned string containing input number plus padding zeros.
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  write(str,FI1PZP) n                              ! Casting of n to string.
  str=str(2:)                                      ! Leaving out the sign.
  if (present(nz_pad)) str=str(DI1P-nz_pad:DI1P-1) ! Leaving out the extra zeros padding
  return
  !---------------------------------------------------------------------------------------------------------------------------------
  endfunction strz_I1P