11/*******************************************************************************************************
22 *
3- * CSVSaver.java, in msi.gama.core, is part of the source code of the GAMA modeling and simulation platform (v.1.9.2 ).
3+ * CSVSaver.java, in msi.gama.core, is part of the source code of the GAMA modeling and simulation platform (v.2.0.0 ).
44 *
55 * (c) 2007-2023 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
66 *
7- * Visit https://github.com/gama-platform/gama for license information and contacts.
7+ * Visit https://github.com/gama-platform/gama2 for license information and contacts.
88 *
99 ********************************************************************************************************/
1010package msi .gaml .statements .save ;
2323import msi .gama .runtime .exceptions .GamaRuntimeException ;
2424import msi .gama .util .GamaListFactory ;
2525import msi .gama .util .IList ;
26+ import msi .gama .util .file .csv .AbstractCSVManipulator ;
2627import msi .gama .util .matrix .GamaMatrix ;
2728import msi .gaml .descriptions .SpeciesDescription ;
2829import msi .gaml .expressions .IExpression ;
@@ -144,12 +145,12 @@ private void save(final IScope scope, final Writer fw, final boolean header, fin
144145 }
145146 if (itemType .id () == IType .MATRIX ) {
146147 GamaMatrix <?> matrix = (GamaMatrix ) value ;
147- matrix .rowByRow (scope , v -> fw .write (toCleanString (v )), () -> fw . write ( "," ),
148- () -> fw .write (Strings .LN ));
148+ matrix .rowByRow (scope , v -> fw .write (toCleanString (v )),
149+ () -> fw .write (AbstractCSVManipulator . getDefaultDelimiter ()), () -> fw . write ( Strings .LN ));
149150 } else {
150151 final int size = values .size ();
151152 for (int i = 0 ; i < size ; i ++) {
152- if (i > 0 ) { fw .write (',' ); }
153+ if (i > 0 ) { fw .write (AbstractCSVManipulator . getDefaultDelimiter () ); }
153154 fw .write (toCleanString (values .get (i )));
154155 }
155156 }
@@ -172,6 +173,7 @@ private void save(final IScope scope, final Writer fw, final boolean header, fin
172173 * @return the string
173174 */
174175 private String toCleanString (final Object o ) {
176+ // Verify this (shouldn't we use AbstractCSVManipulator.getDefaultDelimiter() ?)
175177 String val = Cast .toGaml (o ).replace (';' , ',' );
176178 if (val .startsWith ("'" ) && val .endsWith ("'" ) || val .startsWith ("\" " ) && val .endsWith ("\" " )) {
177179 val = val .substring (1 , val .length () - 1 );
0 commit comments