Package edu.wisc.game.util
Class ImportCSV
java.lang.Object
edu.wisc.game.util.ImportCSV
Methods responsible for parsing CSV files.
See ... for the file format.
- Author:
- Vladimir Menkov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Process a string for writing into a CSV file (as the content of a single cell).static String
Processes all Strings for writing into a CSV file (as one line)static void
escapeAndwriteToFile
(String[][] lines, File f) static String[]
Converts a single string (such as a line of CSV file) into an array of strings.static String[]
-
Constructor Details
-
ImportCSV
public ImportCSV()
-
-
Method Details
-
splitCSVTrim
- Throws:
IllegalInputException
-
splitCSV
Converts a single string (such as a line of CSV file) into an array of strings. Splits a string by commas, with a primitive attempt to take care of nested quotes. This method interprets "" as an escaped ". This is appropriate, for example, for CSV files saved from Google Spreadsheets.- Throws:
IllegalInputException
-
escape
Process a string for writing into a CSV file (as the content of a single cell). Escapes any double quotes the string contains, and surrounds it with double quotes if needed. We also replace multiple spaces with single spaces. -
escape
Processes all Strings for writing into a CSV file (as one line) -
escapeAndwriteToFile
- Throws:
IOException
-