Skip to content

Instantly share code, notes, and snippets.

@seenimohamed
Created February 12, 2018 06:40
Show Gist options
  • Save seenimohamed/de467787901303798708a026237f208d to your computer and use it in GitHub Desktop.
Save seenimohamed/de467787901303798708a026237f208d to your computer and use it in GitHub Desktop.
public static CSVRecord convertToCSVRecord(String query, char delimiter) {
try {
Reader in = new StringReader(query);
CSVParser parser = CSVFormat.newFormat(delimiter).parse(in);
List<CSVRecord> recorder = parser.getRecords();
return recorder.get(0); //returning first element
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment