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

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mklueh authored Oct 16, 2023
1 parent 6a194c5 commit 3caa4af
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[DEPRECATED] *This project was moved to the company's internal repository where I work and is not actively maintained anymore here.*


# SexyCSV

Java CSV parser / creator with the goal of providing the leanest API possible - based on Java 8 Streaming API
Expand Down Expand Up @@ -57,43 +60,40 @@ public class TestEntity {
###### Simple

```java
Path path=Path.of("some-file.csv");
Path path = Path.of("some-file.csv");

SexyCSV.Parser.builder()
.delimiter(",")
.hasHeaderRow(true)
.build()
.parse(path)
.forEach(row->{
String b=row.get("columnName");
});



.delimiter(",")
.hasHeaderRow(true)
.build()
.parse(path)
.forEach(row->{
String value = row.get("columnName");
});
```

###### Extended

```java
Path path=Path.of("some-file.csv");
Path path = Path.of("some-file.csv");

SexyCSV.Parser parser=SexyCSV.Parser.builder()
.delimiter(",")
.hasHeaderRow(true) //auto-use of the given header in the file
//.header(Arrays.asList("id", "name", "age", "country")) set manual header
.skipRows(3)
.rowFilter(s->s.matches("^\\d.*")) //we are only interested in rows that start with a number
//.tokenizer(s -> s.split(";")) optional custom tokenizer
.build();
SexyCSV.Parser parser = SexyCSV.Parser.builder()
.delimiter(",")
.hasHeaderRow(true) //auto-use of the given header in the file
//.header(Arrays.asList("id", "name", "age", "country")) set manual header
.skipRows(3)
.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)
.collect(Collectors.toList());
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")

//or simply parsing to your Java entity

Expand Down Expand Up @@ -186,4 +186,4 @@ creator

### Project Page

[https://mklueh.github.io/sexy-csv/](https://mklueh.github.io/sexy-csv/)
[https://mklueh.github.io/sexy-csv/](https://mklueh.github.io/sexy-csv/)

0 comments on commit 3caa4af

Please sign in to comment.