# CSV Policy C Interface

This interface provides formatting configuration options for parsing CSV. All functions operate via an opaque pointer `CSVPolicyHandle` for internal function calls.

## Character Handling

char get_delimiter(CSVPolicyHandle handle)

  Gets the current field delimiter.

  Parameters:

    - handle – A valid CSV Policy handle.

  Returns:

    The field delimiter character.

bool set_delimiter(CSVPolicyHandle handle, char delim)

  Sets the field delimiter.

  Parameters:

    - handle – A valid CSV Policy handle.

    - delim – The delimiter character to set.

  Returns:

    `true` on success, `false` on failure.

char get_quote(CSVPolicyHandle handle)

  Gets the current string escaping character.

  Parameters:

    - handle – A valid CSV Policy handle.

  Returns:

    The string escaping character.

void set_quote(CSVPolicyHandle handle, char quote)

  Sets the string escaping character.

  Parameters:

    - handle – A valid CSV Policy handle.

    - quote – The string escaping character to set.

void set_no_quote(CSVPolicyHandle handle)

  Disables string escaping.

  Parameters:

    - handle – A valid CSV Policy handle.

bool is_quote_enabled(CSVPolicyHandle handle)

  Checks whether string escaping is enabled.

  Parameters:

    - handle – A valid CSV Policy handle.

  Returns:

    `true` if enabled, otherwise `false`.

void add_trim_char(CSVPolicyHandle handle, char trim_char)

  Adds a character to the set of trim characters. If the character appears before or after a field value, it will be stripped during field value parsing.

  Parameters:

    - handle – A valid CSV Policy handle.

    - trim_char – The character to add to the trim set.

void clear_trim_chars(CSVPolicyHandle handle)

  Clears all trim characters.

  Parameters:

    - handle – A valid CSV Policy handle.

## Column Handling

void ignore_column(CSVPolicyHandle handle, int col)

  Marks a column to be ignored during parsing.

  Parameters:

    - handle – A valid CSV Policy handle.

    - col – The 1‑based column index to ignore.

## Numeric Formatting

char decimal_symbol(CSVPolicyHandle handle)

  Gets the current decimal point symbol.

  Parameters:

    - handle – A valid CSV Policy handle.

  Returns:

    The decimal point symbol.

void set_decimal_symbol(CSVPolicyHandle handle, char symbol)

  Sets the decimal point symbol.

  Parameters:

    - handle – A valid CSV Policy handle.

    - symbol – The decimal point symbol.

char thousand_separator(CSVPolicyHandle handle)

  Gets the current digit grouping separator (e.g., thousands separator).

  Parameters:

    - handle – A valid CSV Policy handle.

  Returns:

    The digit grouping separator.

void set_thousand_separator(CSVPolicyHandle handle, char sep)

  Sets the digit grouping separator (e.g., thousands separator).

  Parameters:

    - handle – A valid CSV Policy handle.

    - sep – The digit grouping separator.

int group_size(CSVPolicyHandle handle)

  Gets the current digit grouping size (e.g., for thousands separators, the group size is 3).

  Parameters:

    - handle – A valid CSV Policy handle.

  Returns:

    The grouping size (number of digits per group).

void set_group_size(CSVPolicyHandle handle, int size)

  Sets the digit grouping size (e.g., for thousands separators, the group size is 3).

  Parameters:

    - handle – A valid CSV Policy handle.

    - size – The grouping size.

## Currency

const char *currency_sign(CSVPolicyHandle handle)

  Gets the current currency sign string (e.g., `"$"`, `"USD"`).

  Parameters:

    - handle – A valid CSV Policy handle.

  Returns:

    The currency sign string.

void set_currency_sign(CSVPolicyHandle handle, const char *sign)

  Sets the currency sign (e.g., `"$"`, `"USD"`).

  Parameters:

    - handle – A valid CSV Policy handle.

    - sign – The currency sign string.

## Date/Time Format

const char *datetime_format(CSVPolicyHandle handle)

  Gets the current date/time format string.

  Parameters:

    - handle – A valid CSV Policy handle.

  Returns:

    The date/time format string.

void set_datetime_format(CSVPolicyHandle handle, const char *fmt)

  Sets the date/time format string.

  Parameters:

    - handle – A valid CSV Policy handle.

    - fmt – The date/time format string (e.g., `"%Y-%m-%d %H:%M:%S"`).

### Date/Time Format Specifier Reference

Specifier | Description | Example
--- | --- | ---
%Y | Full year | 2026
%y | Last two digits of year | 26
%m | Two‑digit month (01 to 12) | 01
%b | Abbreviated month name (Jan, Feb, …) | Jan
%h | Same as %b |
%B | Full month name (January, February, …) | January
%d | Two‑digit day (01 to 31) | 03
%a | Abbreviated weekday (Sun, Mon, …) | Mon
%A | Full weekday (Sunday, Monday, …) | Monday
%H | Hour in 24‑hour format (00 to 23) | 14
%I | Hour in 12‑hour format (01 to 12) | 02
%M | Minute (00 to 59) | 45
%S | Second (00 to 59) | 30
%p | AM or PM (with 12‑hour hour) | AM
%z | Time zone offset (e.g., +0200 or -0800) | +0000
%Z | Time zone name (Only “UTC” is supported) | UTC
%n | Matches whitespace |
%t | Matches whitespace |
%. | Matches any character (skips it) |

Styled using the Piccolo Theme