我有一个 CSV 文件,我想读取该文件并将其存储在案例类中。据我所知,CSV 是一个逗号分隔值文件。但是对于我的 csv 文件,有些数据本身已经带有逗号。它为每个逗号创建新列。所以问题是如何从中拆分数据。
第一个数据
04/20/2021 16:20(1st column) Here a bunch of basic techniques that suit most businesses, and easy-to-follow steps that can help you create a strategy for your social media marketing goals.(2nd column)
第二个数据
11-07-2021 12:15(1st column) Focus on attracting real followers who are genuinely interested in your content, and make the most of your social media marketing efforts.(2nd column)
var i=0
var length=0
val data=Source.fromFile(file)
for (line <- data.getLines) {
val cols = line.split(",").map(_.trim)
length = cols.length
while(i<length){
//println(cols(i))
i=i+1
}
i=0
}