Change CSV delimiter in ServiceStack.Text.CsvSerializer
Asked Answered
B

1

11

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

Barton answered 6/10, 2015 at 6:36 Comment(0)
Z
22

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.)

Zany answered 6/10, 2015 at 7:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.