Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change CSV delimiter in ServiceStack.Text.CsvSerializer

If possible, how can I change the delimiter from comma to semicolon when using ServiceStack.Text.CsvSerializer?

like image 916
devghost Avatar asked Oct 06 '15 06:10

devghost


1 Answers

You can control this by setting

 ServiceStack.Text.CsvConfig.ItemSeperatorString = ";";

From the version 3.9.14 Release Notes:

  • CsvConfig.ItemSeperatorString - Enables configuration of the separator between items in a csv file (ie | or ; rather than ,)
  • CsvConfig.ItemDelimiterString - Enables configuration of the delimiter for an item that needs to be escaped in a csv file (ie | rather than ")
  • CsvConfig.RowSeparatorString - Enables configuration of the delimiter for a row of items in a csv file (ie | \r\n)

Note that the setting is thread static. (Note also the misspelling.)

like image 176
dbc Avatar answered Oct 18 '22 15:10

dbc