Methods
(static) doubleQuoteIfNecessary(input)
Double-quotes the fields according the rules on Wikipedia as of 6/2015. (https://en.wikipedia.org/wiki/Comma-separated_values)
- Fields with embedded commas or double-quote characters must be quoted.
- Each of the embedded double-quote characters must be represented by a pair of double-quote characters.
- Fields with embedded line breaks must be quoted.
- (Python addition) Python csv parser double-quotes
\r
always.
Parameters:
Name | Type | Description |
---|---|---|
input |
string | Input to double quote if necessary. |
- Source:
(static) getArg(argDic, argName, defVal)
Get the argument from the argument dictionary, with a default value. Default value (defval) is returned if the argument is not in the argument:value dictionary, or, if the argument's type is not the same as default value.
Parameters:
Name | Type | Description |
---|---|---|
argDic |
dictionary | A dictionary of the type argName: value |
argName |
string | The name of the argument to be found in dictionary |
defVal |
* | If it cannot find this argName in argDic, it returns defVal. |
- Source:
(static) parseStringToArray(argdic, str)
Given a csv string, it parses it into double array. Delimiter can be changed with argdic's delim parameter.
Follows the csv format described in http://tools.ietf.org/html/rfc4180 as in: "Fields containing line breaks (CRLF), double quotes, and commas should be enclosed in double-quotes."
Parameters:
Name | Type | Description |
---|---|---|
argdic |
dictionary | A dictionary of possible parameters. |
str |
string | csv string to be parsed. Recognized values are:
|
- Source: