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

    All Methods Static Methods Concrete Methods
    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)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ImportCSV

          public ImportCSV()

  - ### Method Detail

    - #### splitCSVTrim

          public static String[] splitCSVTrim​(String s)
                                       throws IllegalInputException

      Throws:
        `IllegalInputException`

    - #### splitCSV

          public static String[] splitCSV​(String s)
                                   throws IllegalInputException

      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

          public static String escape​(String s)

      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

          public static String escape​(String[] ss)

      Processes all Strings for writing into a CSV file (as one line)

    - #### escapeAndwriteToFile

          public static void escapeAndwriteToFile​(String[][] lines,
                                                  File f)
                                           throws IOException

      Throws:
        `IOException`