Csv Module
Reads a typed value from a named column of a row of text and splits CSV text into rows. An unknown column raises a KeyNotFoundException.
Types and nested modules
| Type/Module | Description |
|
Holds the Unquote tests of the Csv cast, parse and column functions. |
|
|
|
Functions and values
| Function or value |
Description
|
Full Usage:
getColumn dataType columns row name
Parameters:
DataType
columns : string array
row : string array
name : string
Returns: 'T
Modifiers: inline Type parameters: 'T |
Get a column from a row of a CSV file. Example: getColumn StringData [| "a"; "b" |] [| "1"; "2" |] "a" will return "1".
Header names are matched case-insensitively, and an unknown column name
RAISES a
|
Full Usage:
getDecimalColumn columns sl s
Parameters:
string array
sl : string array
s : string
Returns: decimal
|
|
Full Usage:
getDecimalOptionColumn columns sl s
Parameters:
string array
sl : string array
s : string
Returns: decimal option
|
|
Full Usage:
getFloatColumn columns sl s
Parameters:
string array
sl : string array
s : string
Returns: float
|
|
Full Usage:
getFloatOptionColumn columns sl s
Parameters:
string array
sl : string array
s : string
Returns: float option
|
|
Full Usage:
getInt32Column columns sl s
Parameters:
string array
sl : string array
s : string
Returns: int
|
|
Full Usage:
getInt32OptionColumn columns sl s
Parameters:
string array
sl : string array
s : string
Returns: int option
|
|
Full Usage:
getStringColumn columns sl s
Parameters:
string array
sl : string array
s : string
Returns: string
|
|
Full Usage:
parse isOption typeDescr tryParse x
Parameters:
bool
typeDescr : 'a
tryParse : 'b -> 'c option
x : 'b
Returns: objnull
Modifiers: inline Type parameters: 'a, 'b, 'c |
Flexible parsing function with optional option wrapping and error handling. This function attempts parsing using the provided tryParse function. Depending on the isOption flag, the parsed value can be wrapped in an Option or not. If parsing fails, it handles errors by returning None or throwing an exception. Parameters: - isOption: Flag indicating whether to wrap the parsed value in an Option. - typeDescr: Description of the target type for error messages. - tryParse: Function attempting to parse the input value and returning an Option. - x: Input value to be parsed. Returns: - Parsed value (wrapped in Option if isOption is true). Exceptions: - Throws an exception with error message if parsing fails and isOption is false.
|
Full Usage:
parseCSV s
Parameters:
string
Returns: string array array
|
|
Full Usage:
tryCast dt x
Parameters:
DataType
x : string
Returns: 'T
Modifiers: inline Type parameters: 'T |
Try to cast a string to a value of the given type. Example: "123" |> tryCast Int32Data will return 123.
|
GenPRES