csv(3f) - [M_csv] prints up to 20 standard scalar types to a string in CSV style (LICENSE:PD)
Synopsis
Description
Options
Returns
Examples
Author
License
function csv(g1,g2,g3,..g20)
class(*),intent(in),optional :: g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 & g11,g12,g13,g14,g15,g16,g17,g18,g19,g20 character,len=(:),allocatable :: csv
csv(3f) builds a CSV string from up to twenty scalar values or an array.Although it will often work, using csv(3f) in an I/O statement is not recommended as the csv(3f) routine might generate error messages; and Fortran does not (yet) support recursive I/O.
g[1-20] optional values to print the value of. May be of type INTEGER, LOGICAL, REAL, DOUBLEPRECISION, COMPLEX, or CHARACTER.
csv a string in CSV (Comma-Separated Values) format representing the input values
Sample program:
program demo_csv use M_csv, only : csv implicit none character(len=:),allocatable :: prResults:write(*,*)LIST-DIRECTED: write(*,*,DELIM=QUOTE)string,.true.,.false.,111,23.45,10.20e15,3456.78901234d0,cmplx(huge(0.0),tiny(0.0))
write(*,*)G0: write(*,(*(g0:",")))string,.true.,.false.,111,23.45,10.20e15,3456.78901234d0,cmplx(huge(0.0),tiny(0.0))
write(*,*)CSV: pr=csv(string,.true.,.false.,111,23.45,10.20e15,3456.78901234d0,cmplx(huge(0.0),tiny(0.0)) ) write(*,(a))pr
end program demo_csv
LIST-DIRECTED: "string" T F 111 23.4500008 1.01999997E+16 3456.7890123400002 (3.402823466E+38,1.175494351E-38) G0:string,T,F,111,23.4500008,0.101999997E+17,3456.7890123400002,0.340282347E+39,0.117549435E-37 CSV: "string",TRUE,FALSE,111,23.4500008,1.01999997E+16,3456.7890123400002,3.40282347E+38,1.17549435E-38
John S. Urban
Public Domain
Nemo Release 3.1 | csv (3) | February 23, 2025 |