Skip to content

CSVParser

Type class

A parser for CSV format.

Sources

CSVParser can be used (imported) via one of the following packages.

/**
* Import from: "core.ts"
* Use like: am4core.CSVParser
*/
import * as am4core from "@amcharts/amcharts4/core";

Inheritance

CSVParser extends DataParser.

CSVParser is not extended by any other symbol.

Properties

contentType

Type stringDefault "text/csv"

Content-type suitable for CSV format.

Methods

CSVToArray(data: string,
delimiter: string
)

Returns any[]

Converts CSV into array.

The functionality of this function is taken from here:

http://www.bennadel.com/blog/1504-ask-ben-parsing-csv-strings-with-javascript-exec-regular-expression-command.htm

getDelimiterFromData(data: string)

StaticReturns string

Tries to determine a column separator.

isCSV(data: string)

StaticReturns boolean

Tests if the format is CSV.

parse(csv: string)

Returns any[]

Parses and returns data.

Events

CSVParser does not have any events.