3
我有我需要解析的不規則(儘管一致)「csv」文件。內容是這樣的:Univocity - 不規則的csv解析
Field1: Field1Text
Field2: Field2Text
Field3 (need to ignore)
Field4 (need to ignore)
Field5
Field5Text
// Cars - for example
#,Col1,Col2,Col3,Col4,Col5,Col6
#1,Col1Text,Col2Text,Col3Text,Col4Text,Col5Text,Col6Text
#2,Col1Text,Col2Text,Col3Text,Col4Text,Col5Text,Col6Text
#3,Col1Text,Col2Text,Col3Text,Col4Text,Col5Text,Col6Text
理想我想使用類似的方法爲here。
我最終要與像的目的是結束:
String field1;
String field2;
String field5;
List<Car> cars;
我現在有以下幾個問題:
- 增加了一些探索性測試後,用哈希開始(#)線被忽略。我不想要這個,反正有逃跑嗎?
- 我的目的是爲cars部分使用BeanListProcessor,並使用單獨的行處理器處理其他字段。然後將結果合併到上述對象中。我在這裏想念任何技巧嗎?
感謝您花時間回覆傑羅尼莫。也很喜歡使用解析器! – Hurricane