Skip to content

Commit 5e33db6

Browse files
authored
Create README.md
1 parent 3958047 commit 5e33db6

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# CSV-Validation - Java 8
2+
3+
An example of how to reads a CSV file, validate the input data, and output the data to standard output. It performs validation on fields like **id**, **name**, **birthday**, **gender**, and **phone number** based on specific rules. The validated data is output along with error messages for invalid data. The header of the CSV file is excluded from validation.
4+
5+
There are only two classes in this project.<br>
6+
[Main.java ](https://github.com/poralcode/CSV-Validation/blob/master/src/Main.java "Main.java ")- The main class that contains the logic for reading the CSV file.<br>
7+
[Validation.java](https://github.com/poralcode/CSV-Validation/blob/master/src/Validation.java "Validation.java") - The class that provides validation logic for the fields in a CSV file.
8+
9+
------------
10+
11+
12+
**SAMPLE FILE INPUT:** writers.csv
13+
> id,name,birthday,gender,phone-number<br>
14+
1,Liam,02/1994/29,male,09011112222<br>
15+
2,Austin,1994/10/10,female,08033334444<br>
16+
3,,1989/01/23,female,0355556666<br>
17+
18+
------------
19+
20+
21+
**CONSOLE OUTPUT:**
22+
> id,name,birthday,gender,phone-number<br>
23+
1,Liam,**Error format**,male,09011112222<br>
24+
2,Austin,1994/10/10,female,08033334444<br>
25+
3,**Error required**,1989/01/23,female,0355556666
26+
27+
------------
28+
29+
30+
**VALIDATION DETAILS:**
31+
32+
| FIELD | VALIDATION | ERROR MESSAGE | CONDITIONS |
33+
| ------------- | -------------- | ------------------- | ------------------ |
34+
| id | Mandatory, Numerical | Error Required, Error Format | Mandtory Item. Numerical values only.
35+
| name | Mandatory, Length limitation | Error required, Error limit over | Mandatory item. 100 characters only.
36+
| birthday | Mandatory, Format | Error required, Error format | Mandatory Item. yyyy/mm/dd or yyyy-mm-dd format only
37+
| gender | Format | Error format | **Male** or **Female** (uppercase, lowercase, or empty data is allowed.)
38+
| phone-number | Mandatory, Format |Error required, Error format| Mandatory item. Format should be 000-0000-0000 or 00-0000-0000 or 000-000-0000 or 0000-00-0000 half-width number format or 00000000000 half-width number format around 10-11 characters.
39+

0 commit comments

Comments
 (0)