[UP]


Manual Reference Pages  - csv (3)

NAME

csv(3f) - [M_csv] prints up to 20 standard scalar types to a string in CSV style (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Returns
Examples
Author
License

SYNOPSIS

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

DESCRIPTION

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.

OPTIONS

g[1-20]
  optional values to print the value of. May be of type INTEGER, LOGICAL, REAL, DOUBLEPRECISION, COMPLEX, or CHARACTER.

RETURNS

csv a string in CSV (Comma-Separated Values) format representing the input values

EXAMPLES

Sample program:

   program demo_csv
   use M_csv, only : csv
   implicit none
   character(len=:),allocatable :: pr

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

Results:

    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

AUTHOR

John S. Urban

LICENSE

Public Domain


csv (3) March 11, 2021
Generated by manServer 1.08 from 6de02055-1099-4765-9749-49e1965f4bb5 using man macros.