I wanted to know, if we can search a particular row in a csv (as we do in UI using find) containing a particular word. Does opencsv provide this functionality ?
If not, what is the best way to search in csv file.
I wanted to know, if we can search a particular row in a csv (as we do in UI using find) containing a particular word. Does opencsv provide this functionality ?
If not, what is the best way to search in csv file.
No it doesn't but you could simply iterate through the fields
CSVReader reader = new CSVReader(new FileReader("yourfile.csv"));
String [] nextLine;
String searchWord = ".*\\d+.*"; // field contains integer?
while ((nextLine = reader.readNext()) != null) {
for (String field: nextLine) {
if (field.matches(searchWord)) {
// matched word...
}
}
}