strz_I8P Function

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

The function strz_I8P 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=I8P), intent(in) :: n

Return Value character(len=DI8P)


Called by

proc~~strz_i8p~~CalledByGraph proc~strz_i8p strz_I8P interface~strz strz interface~strz->proc~strz_i8p

Contents

Source Code


Source Code

  elemental function strz_I8P(nz_pad,n) result(str)
  !---------------------------------------------------------------------------------------------------------------------------------
  !!The function strz\_I8P 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(I8P), intent(IN)::           n      ! Integer to be converted.
  character(DI8P)::                    str    ! Returned string containing input number plus padding zeros.
  !---------------------------------------------------------------------------------------------------------------------------------

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