读取 csv 的指定列
有个格式规范的 csv 文件
Region,Country,City,Year,Month,Day,Support Consultant Europe,Sweden,Stockholm,2014,12,31,B. Good Europe,Sweden,Stockholm,2014,11,21,B. Good North Africa/Middle East,Saudi Arabia,Riyadh,2014,12,9,E. Gipt |
要求用 Java 实现:以指定的多个列号为参数,从 csv 文件中取出多列,解析为二维表。比如参数是 "#1,#3,#5" 时:
Region |
City |
Month |
Europe |
Stockholm |
12 |
Europe |
Stockholm |
11 |
North Africa/Middle East |
Riyadh |
12 |
编写SPL代码:
=T(\"d:\\result.csv\":T(\"d:\\data.csv\",${arg_cols}))
函数T解析或写入文件,可指定多个列号。${}将字符串当表达式执行。
英文版 https://c.scudata.com/article/1725521271729