Skip to content

Commit d33f65f

Browse files
committed
update initialize routine to set quote options.
1 parent 4ffc3ab commit d33f65f

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

src/csv_module.f90

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,18 +115,29 @@ module csv_module
115115
!>
116116
! Constructor.
117117

118-
subroutine initialize_csv_file(me,quote,delimiter,verbose)
118+
subroutine initialize_csv_file(me,quote,delimiter,&
119+
enclose_strings_in_quotes,&
120+
enclose_all_in_quotes,&
121+
verbose)
119122

120123
implicit none
121124

122125
class(csv_file),intent(out) :: me
123-
character(len=1),intent(in),optional :: quote !! note: can only be one character
124-
character(len=1),intent(in),optional :: delimiter !! note: can only be one character
126+
character(len=1),intent(in),optional :: quote !! note: can only be one character
127+
character(len=1),intent(in),optional :: delimiter !! note: can only be one character
128+
logical,intent(in),optional :: enclose_strings_in_quotes !! if true, all string cells
129+
!! will be enclosed in quotes.
130+
logical,intent(in),optional :: enclose_all_in_quotes !! if true, *all* cells will
131+
!! be enclosed in quotes.
125132
logical,intent(in),optional :: verbose
126133

127-
if (present(quote)) me%quote = quote
128-
if (present(delimiter)) me%delimiter = delimiter
129-
if (present(verbose)) me%verbose = verbose
134+
if (present(quote)) me%quote = quote
135+
if (present(delimiter)) me%delimiter = delimiter
136+
if (present(enclose_strings_in_quotes)) &
137+
me%enclose_strings_in_quotes = enclose_strings_in_quotes
138+
if (present(enclose_all_in_quotes)) &
139+
me%enclose_all_in_quotes = enclose_all_in_quotes
140+
if (present(verbose)) me%verbose = verbose
130141

131142
end subroutine initialize_csv_file
132143
!*****************************************************************************************
@@ -1127,8 +1138,8 @@ end subroutine read_line_from_file
11271138
!
11281139
!### Example
11291140
!````Fortran
1130-
! type(csv_file) :: f
1131-
! character(len=:),allocatable :: s
1141+
! type(csv_file) :: f
1142+
! character(len=:),allocatable :: s
11321143
! type(csv_string),dimension(:),allocatable :: vals
11331144
! s = '1,2,3,4,5'
11341145
! vals = f%split(s,',')

0 commit comments

Comments
 (0)