I am parsing a csv file with Apache Commons CSVRecord and CSVFormat in Java I got the following record in String format Records : CSVRecord [comment=null, mapping={Id=0, FirstName=1, LastName=2}, recordNumber=1, values=[1, John, Wayne]]
I need to extract the values only For ex: 1, John, Wayne
Used the following options to get the result.
String[] split = record.split("values=\\[");
String result = split[1].substring(0, split[1].length() - 2);
My Question is: Is there a better option(Faster) than this in Java?
CSVRecord.toString()value? What exactly are you doing?CSVRecord.get()methods or theCSVRecord.iterator()orCSVRecord.toMap()to acces the valuesvalues=[or,(the first one is unlikely, the second maybe less)