Haskell的完全功能的CSV解析器? [英] Fully featured CSV parser for Haskell?
问题描述
任何人都可以建议使用以下选项解析CSV文件:
- 设置单元格/字段分隔符
- 设置记录结束/行终止符
- 为字段设置引号字符
- 支持UTF-8字符串
- 将内存中CSV结构写回文件的能力
我尝试了Text.CSV,简单和缺乏上述大部分功能。
是否有一些更高级的CSV解析模块,或者我必须从头开始编写,即使用Text.ParserCombinators?
p>我不能推荐一个现成的,打包的Haskell的CSV解析器,但我记得这本书 由
相关的 /book.realworldhaskell.org/read/using-parsec.htmlrel =noreferrer>第16章:使用Parsec 可在线获取;请检查标题为扩展示例:完整CSV解析器的部分。
Can anybody recommend a way to parse CSV files with options to:
- set cells/fields separator
- set end of record/row terminator
- set quote-character for fields
- support of UTF-8 strings
- ability to write in-memory CSV structure back to a file
I did try Text.CSV but it's very simple and lacks most of the above features. Is there some more advanced CSV parsing module or do I have to write it "from scratch" i.e. using Text.ParserCombinators? I do not intend to reinvent a wheel.
Take care.
I can't recommend a ready-to-go, packaged-up CSV parser for Haskell, but I remember that the book Real-World Haskell by Bryan O'Sullivan et al. contains a chapter on Parsec, which the authors demonstrate by creating a CSV parser.
The relevant chapter 16: Using Parsec is available online; check the section titled Extended Example: Full CSV Parser.
这篇关于Haskell的完全功能的CSV解析器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!