Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

Commit

Permalink
dealing with missing cells using tab delimiter
Browse files Browse the repository at this point in the history
  • Loading branch information
mklueh committed Feb 27, 2021
1 parent d05e5b5 commit 9e462ac
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ Very tiny Java CSV parser based on Java 8 Streaming API and Lombok that is simpl
```java
Path path = Path.of("some-file.csv");

SexyCSV parser=SexyCSV.builder()
SexyCSV parser = SexyCSV.builder()
.delimiter(",")
.hasHeader(true) //auto-use of the given header
//.header(Arrays.asList("id", "name", "age", "country")) set manual headers
.skipRows(3)
.rowFilter(s->s.matches("^\\d.*")) //we are only interested in rows that start with a number
.rowFilter(s -> s.matches("^\\d.*")) //we are only interested in rows that start with a number
//.tokenizer(s -> s.split(";")) optional custom tokenizer
.build();

List<Row> data=parser.parse(path)
List<Row> data = parser.parse(path)
.collect(Collectors.toList());

Row firstRow=data.get(0);
Row firstRow = data.get(0);

// Access cells
String a=row.get(1);
String b=row.get("columnName")
String a = row.get(1);
String b = row.get("columnName")


```
Expand Down

0 comments on commit 9e462ac

Please sign in to comment.