dc_string::tochar Interface Reference

Private Member Functions

character(token) function itoa_scalar (i)
 
character(string) function itoa_array (ibuf)
 
character(token) function rtoa_scalar (x)
 
character(string) function rtoa_array (rbuf)
 
character(token) function dtoa_scalar (d)
 
character(string) function dtoa_array (dbuf)
 
character(token) function ltoa_scalar (l)
 
character(string) function ltoa_array (lbuf)
 

Detailed Description

Definition at line 73 of file dc_string.f90.

Member Function/Subroutine Documentation

◆ dtoa_array()

character(string) function dc_string::tochar::dtoa_array ( real(dp), dimension(:), intent(in)  dbuf)
private

Definition at line 804 of file dc_string.f90.

804  !
805  ! 倍精度実数型配列 dbuf(:) で与えられる数値を文字型変数にして返します。
806  ! 配列が与えられる場合、各要素をカンマと空白「<tt>, </tt>」
807  ! で区切って返します。
808  !
809  real(DP), intent(in):: dbuf(:)
810  integer:: i
811  continue
812  if (size(dbuf) <= 0) then
813  result = ""
814  return
815  endif
816  result = tochar(dbuf(1))
817  do, i = 2, size(dbuf)
818  result = trim(result) // ", " // trim(tochar(dbuf(i)))
819  enddo

◆ dtoa_scalar()

character(token) function dc_string::tochar::dtoa_scalar ( real(dp), intent(in)  d)
private

Definition at line 777 of file dc_string.f90.

777  !
778  ! 倍精度実数型変数 d で与えられる数値を文字型変数にして返します。
779  ! 配列が与えられる場合、各要素をカンマと空白「<tt>, </tt>」
780  ! で区切って返します。
781  !
782  real(DP), intent(in):: d
783  character(len = 32):: buffer, expbuf
784  integer:: ptr, eptr
785  continue
786  write(unit=buffer, fmt="(g32.24)") d
787  eptr = scan(buffer, "eE", back=.true.)
788  expbuf = ''
789  if (eptr > 1) then
790  expbuf = buffer(eptr: )
791  buffer(eptr: ) = " "
792  end if
793 
794  ptr = verify(buffer, " 0", back=.true.)
795  if (ptr > 0) buffer(ptr+1: ) = " "
796 
797  if (eptr > 1) then
798  buffer = buffer(1:len_trim(buffer)) // expbuf
799  end if
800  result = adjustl(buffer)

◆ itoa_array()

character(string) function dc_string::tochar::itoa_array ( integer, dimension(:), intent(in)  ibuf)
private

Definition at line 712 of file dc_string.f90.

712  !
713  ! 整数型配列変数 ibuf(:) で与えられる数値を文字型変数にして返します。
714  ! 配列が与えられる場合、各要素をカンマと空白「<tt>, </tt>」
715  ! で区切って返します。
716  !
717  integer, intent(in):: ibuf(:)
718  integer:: i
719  continue
720  if (size(ibuf) <= 0) then
721  result = ""
722  return
723  endif
724  result = tochar(ibuf(1))
725  do, i = 2, size(ibuf)
726  result = trim(result) // ", " // trim(tochar(ibuf(i)))
727  enddo

◆ itoa_scalar()

character(token) function dc_string::tochar::itoa_scalar ( integer, intent(in)  i)
private

Definition at line 699 of file dc_string.f90.

699  !
700  ! 整数型変数 i で与えられる数値を文字型変数にして返します。
701  ! 配列が与えられる場合、各要素をカンマと空白「<tt>, </tt>」
702  ! で区切って返します。
703  !
704  integer, intent(in):: i
705  character(len = 32):: buffer
706  continue
707  write(unit=buffer, fmt="(i20)") i
708  result = adjustl(buffer)

◆ ltoa_array()

character(string) function dc_string::tochar::ltoa_array ( logical, dimension(:), intent(in)  lbuf)
private

Definition at line 838 of file dc_string.f90.

838  !
839  ! 論理型配列 lbuf(:) で与えられる数値を文字型変数にして返します。
840  ! 配列が与えられる場合、各要素をカンマと空白「<tt>, </tt>」
841  ! で区切って返します。
842  !
843  logical, intent(in):: lbuf(:)
844  integer:: i
845  continue
846  if (size(lbuf) <= 0) then
847  result = ""
848  return
849  endif
850  result = tochar(lbuf(1))
851  do, i = 2, size(lbuf)
852  result = trim(result) // ", " // trim(tochar(lbuf(i)))
853  enddo

◆ ltoa_scalar()

character(token) function dc_string::tochar::ltoa_scalar ( logical, intent(in)  l)
private

Definition at line 823 of file dc_string.f90.

823  !
824  ! 論理型変数 l で与えられる数値を文字型変数にして返します。
825  ! 配列が与えられる場合、各要素をカンマと空白「<tt>, </tt>」
826  ! で区切って返します。
827  !
828  logical, intent(in):: l
829  continue
830  if (l) then
831  result = ".true."
832  else
833  result = ".false."
834  end if

◆ rtoa_array()

character(string) function dc_string::tochar::rtoa_array ( real, dimension(:), intent(in)  rbuf)
private

Definition at line 758 of file dc_string.f90.

758  !
759  ! 単精度実数型配列 rbuf(:)、で与えられる数値を文字型変数にして返します。
760  ! 配列が与えられる場合、各要素をカンマと空白「<tt>, </tt>」
761  ! で区切って返します。
762  !
763  real, intent(in):: rbuf(:)
764  integer:: i
765  continue
766  if (size(rbuf) <= 0) then
767  result = ""
768  return
769  endif
770  result = tochar(rbuf(1))
771  do, i = 2, size(rbuf)
772  result = trim(result) // ", " // trim(tochar(rbuf(i)))
773  enddo

◆ rtoa_scalar()

character(token) function dc_string::tochar::rtoa_scalar ( real, intent(in)  x)
private

Definition at line 731 of file dc_string.f90.

731  !
732  ! 単精度実数型変数 x で与えられる数値を文字型変数にして返します。
733  ! 配列が与えられる場合、各要素をカンマと空白「<tt>, </tt>」
734  ! で区切って返します。
735  !
736  real, intent(in):: x
737  character(len = 16):: buffer, expbuf
738  integer:: ptr, eptr
739  continue
740  write(unit=buffer, fmt="(g16.8)") x
741  eptr = scan(buffer, "eE", back=.true.)
742  expbuf = ''
743  if (eptr > 1) then
744  expbuf = buffer(eptr: )
745  buffer(eptr: ) = " "
746  end if
747 
748  ptr = verify(buffer, " 0", back=.true.)
749  if (ptr > 0) buffer(ptr+1: ) = " "
750 
751  if (eptr > 1) then
752  buffer = buffer(1:len_trim(buffer)) // expbuf
753  end if
754  result = adjustl(buffer)

The documentation for this interface was generated from the following file: