zufuliu / notepad4

Notepad4 (Notepad2⨯2, Notepad2++) is a light-weight Scintilla based text editor for Windows with syntax highlighting, code folding, auto-completion and API list for many programming languages and documents, bundled with file browser plugin matepath.
Other
3.31k stars 211 forks source link

Auto detect CSV delimiter #892

Open zufuliu opened 1 week ago

zufuliu commented 1 week ago
          是否有命令行可以指定分隔符?目前用 `/s csv` 参数只能以默认的 `,` 分隔,我想对某一类文件直接启用 `|` 分隔。

Notepad4_NF50ooj6oh

Originally posted by @Mapaler in https://github.com/zufuliu/notepad4/issues/453#issuecomment-2418117328

Mapaler commented 1 week ago

建议增加一个自定义字符串参数,任何其他参数的附加功能都可以从这里面调用,比如
It is recommended to add a custom string parameter, from which additional functions of any other parameter can be called, for example
/s csv /option "{split:|,quote:\"}" 或者是给/s参数的内容增加一个分隔符,参数写在分隔符后面,比如
Or add a delimiter to the content of the /s parameter, and write the parameter after the delimiter, for example
/s "csv|{split:\|,quote:\"}"

zufuliu commented 1 week ago

建议增加一个自定义字符串参数

I'm planning to auto detect the delimiter with a naive method: https://github.com/zufuliu/notepad4-test/blob/main/script/Issue892.py

The result is good after test CSV files from https://github.com/ws-garcia/CSVsniffer

zufuliu commented 1 week ago

Implemented by 4243079afb8961896a7253e01d1b247a1aa3771f, please test latest build from https://github.com/zufuliu/notepad4/actions