escape_csv

Escapes a string for use in CSV format by doubling the enclosure character.

Examples

1
2
{{ "Hello \"World\"" | escape_csv }} => "Hello \"\"World\"\""
{{ "Test, with comma" | escape_csv }} => "Test, with comma"

Input

Type Parameter Description Required
string val The string to escape. Comes before the | sign. Required
string enclosure The character used to enclose fields (default: ‘”’)  

Output

Type Description
string The escaped string with doubled enclosure characters