|
Java™ by example!
|
|
|
How do I read a comma delimited file (CSV) using the regex package?
Use the method Pattern.split which creates an array of strings around your regular expression. Main.java:
Example CSV file, test.csv:
Output:
Alternatively, you can use the method split that was introduced in the String class since 1.4. Main.java:
Further Information
Author of answer: Joris Van den Bogaert
Comments to this answer are only viewable by members. Login or become a member!
|
|
|
|
|