Package edu.wisc.game.util
Class ImportCSV
java.lang.Object
edu.wisc.game.util.ImportCSV
public class ImportCSV extends Object
Methods responsible for parsing CSV files.
See ... for the file format.
- Author:
- Vladimir Menkov
-
Constructor Summary
Constructors Constructor Description ImportCSV()
-
Method Summary
Modifier and Type Method Description static String
escape(String s)
Process a string for writing into a CSV file (as the content of a single cell).static String
escape(String[] ss)
Processes all Strings for writing into a CSV file (as one line)static void
escapeAndwriteToFile(String[][] lines, File f)
static String[]
splitCSV(String s)
Converts a single string (such as a line of CSV file) into an array of strings.static String[]
splitCSVTrim(String s)
-
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
-