1. Copyright (c) 2022 amin2312
  2. Version 1.0.0
  3. MIT License

ACsv is a easy, fast and powerful csv parse library.

Variables

body:Array<Array<Dynamic>>

Parsed csv table Body.

content:String

The raw content.

head:Array<Field>

Parsed csv table Head.

Methods

createIndexAt(colIndex:Int):Void

Create index for the specified column.
This function is only valid for "selectWhenE" and "limit" param is 1.
It will improve performance.

Parameters:

colIndex

column index

getColIndexBy(name:String):Int

Get column index by specified field name.

Parameters:

name

As name mean

Returns:

column index

getCurrentSelector():Array<Dynamic>

Get current selector(it includes all selected results).
Notice: It be assigned after call "select..." function

Returns:

current selector

id(value:Dynamic, ?colIndex:Int):Dynamic

Fetch a row object when the column's value is equal to the id value

Parameters:

values

the specified value

colIndex

specified column index

Returns:

selected row object

merge(b:Table):Table

Merge a table.
Notice: two tables' structure must be same.

Parameters:

b

source table

Returns:

THIS instance

selectAll():Table

Select all rows.

Returns:

THIS instance (for Method Chaining), can call "to..." or "select..." function in next step.

selectAt(rowIndices:Array<Int>):Table

Selects the specified rows by indices.

Parameters:

rowIndices

specified row's indices

Returns:

THIS instance (for Method Chaining), can call "to..." or "select..." function in next step.

selectFirstRow():Table

Select the first row.

Returns:

THIS instance (for Method Chaining), can call "to..." or "select..." function in next step.

selectLastRow():Table

Select the last row.

Returns:

THIS instance (for Method Chaining), can call "to..." or "select..." function in next step.

selectWhenE(limit:Int, value:Dynamic, ?colIndex:Int, ?extraSelector:Array<Array<Dynamic>>):Table

Select the rows when the column's value is equal to specified value.

Parameters:

limit

maximum length of selected results (0 is infinite, if you only need 1 result, 1 is recommended, it will improve performance)

value

the specified value

colIndex

specified column index

extraSelector

extra selector, use it to save selected result

Returns:

THIS instance (for Method Chaining), can call "to..." or "select..." function in next step.

selectWhenE2(limit:Int, value1:Dynamic, value2:Dynamic, ?colIndex2:Int, ?colIndex1:Int):Table

Select the rows when the column's values are equal to specified values.

Parameters:

limit

maximum length of selected results (0 is infinite, if you only need 1 result, 1 is recommended, it will improve performance)

value1

first specified value

value2

second specified value

colIndex2

second specified column index

colIndex1

first specified column index

Returns:

THIS instance (for Method Chaining), can call "to..." or "select..." function in next step.

selectWhenE3(limit:Int, value1:Dynamic, value2:Dynamic, value3:Dynamic, ?colIndex3:Int, ?colIndex2:Int, ?colIndex1:Int):Table

Select the rows when the column's values are equal to specified values.

Parameters:

limit

maximum length of selected results (0 is infinite, if you only need 1 result, 1 is recommended, it will improve performance)

value1

first specified value

value2

second specified value

value3

third specified value

colIndex3

third specified column index

colIndex2

second specified column index

colIndex1

first specified column index

Returns:

THIS instance (for Method Chaining), can call "to..." or "select..." function in next step.

selectWhenG(limit:Int, withEqu:Bool, value:Float, ?colIndex:Int):Table

Select the rows when the column's value is greater than specified value.

Parameters:

limit

maximum length of selected results (0 is infinite, if you only need 1 result, 1 is recommended, it will improve performance)

withEqu

whether include equation

value

the specified value

colIndex

specified column index

Returns:

THIS instance (for Method Chaining), can call "to..." or "select..." function in next step.

selectWhenGreaterAndLess(limit:Int, GWithEqu:Bool, LWithEqu:Bool, GValue:Float, LValue:Float, ?colIndex:Int):Table

Select the rows when the column's value is greater than specified value and less than specified value.

Parameters:

limit

maximum length of selected results (0 is infinite, if you only need 1 result, 1 is recommended, it will improve performance)

GWithEqu

whether greater and equal

LWithEqu

whether less and equal

GValue

the specified greater value

LValue

the specified less value

colIndex

specified column index

Returns:

THIS instance (for Method Chaining), can call "to..." or "select..." function in next step.

selectWhenIn(limit:Int, values:Array<Dynamic>, ?colIndex:Int):Table

Select the rows when the column's value is equal to any value of array.

Parameters:

limit

maximum length of every selected results (0 is infinite, if you only need 1 result, 1 is recommended, it will improve performance)

values

the array of values

colIndex

specified column index

Returns:

THIS instance (for Method Chaining), can call "to..." or "select..." function in next step.

selectWhenL(limit:Int, withEqu:Bool, value:Float, ?colIndex:Int):Table

Select the rows when the column's value is less than specified values.

Parameters:

limit

maximum length of selected results (0 is infinite, if you only need 1 result, 1 is recommended, it will improve performance)

withEqu

whether include equation

value

the specified value

colIndex

specified column index

Returns:

THIS instance (for Method Chaining), can call "to..." or "select..." function in next step.

selectWhenLessOrGreater(limit:Int, LWithEqu:Bool, GWithEqu:Bool, LValue:Float, GValue:Float, ?colIndex:Int):Table

Select the rows when the column's value is less than specified value or greater than specified value.

Parameters:

limit

maximum length of selected results (0 is infinite, if you only need 1 result, 1 is recommended, it will improve performance)

LWithEqu

whether less and equal

GWithEqu

whether greater and equal

LValue

the specified less value

GValue

the specified greater value

colIndex

specified column index

Returns:

THIS instance (for Method Chaining), can call "to..." or "select..." function in next step.

sortBy(colIndex:Int, sortType:Int):Table

Sort by selected rows.

Parameters:

colIndex

the column index specified for sorting

sortType

0: asc, 1: desc

Returns:

THIS instance (for Method Chaining), can call "to..." or "select..." function in next step.

toFirstObj():Dynamic

Fetch first selected result to a object and return it.

Returns:

first selected row object or null

toFirstRow():Array<Dynamic>

Fetch first selected result to a row and return it.

Returns:

first selected row data or null

toLastObj():Dynamic

Fetch last selected result to a object and return it.

Returns:

last selected row object or null

toLastRow():Array<Dynamic>

Fetch last selected result to a row and return it.

Returns:

last selected row data or null

toObjs():Array<Dynamic>

Fetch all selected results to the objects and return it.

Returns:

a array of row object (even if the result is empty)

toRows():Array<Array<Dynamic>>

Fetch all selected results to the rows and return it.

Returns:

a array of row data (even if the result is empty)

toTable():Table

Fetch all selected results to a new table.

Returns:

a new table instance

Static methods

staticParse(content:String, ?filedSeparator:String, ?filedDelimiter:String):Table

Parse csv conent.

Parameters:

content

As name mean

filedSeparator

filed separator

filedDelimiter

filed delimiter

Returns:

a table instance