Skip to content

Instantly share code, notes, and snippets.

View mjhagen's full-sized avatar

Mingo Hagen mjhagen

View GitHub Profile
@mjhagen
mjhagen / csv.cfc
Created April 26, 2021 14:47
CSV Parser using Univocity in CFML / ColdFusion
component accessors=true {
public any function getCSVParser(
boolean delimiterDetectionEnabled = true,
boolean headerExtractionEnabled = true,
boolean lineSeparatorDetectionEnabled = true,
boolean quoteDetectionEnabled = true
) {
var csvParserSettings = createObject( 'java', 'com.univocity.parsers.csv.CsvParserSettings' );
csvParserSettings.setDelimiterDetectionEnabled( delimiterDetectionEnabled );
csvParserSettings.setHeaderExtractionEnabled( headerExtractionEnabled );