Posted Post

Posted People, Posted Life.

Archive for August 13, 2008

ASP Function CSV2Array, VBScript CSV Format to Array

A useful function by ASP, VBScript, from CSV text file(string) to an Array data type.

vCSV: the string of CSV text
vDelimiter: the delimiter of CSV, normal use comma,
vQualifier: the qualifier, some CSV file use empty, others use “inverted comma” or “quotation marks”

Example:

CSV File:

Name,Age,Gender
Alen,25,Female
Alex,18,Female
Eric,30,Male

The Array you get will look like:

Array [

Name, Alen, Alex, Eric
Age, 25, 28, 30
Gender, Female, Female, Male

]

Array(0, 0) = “Name”
Array(0, 1) = “Alen”
Array(1, 0) =”Age”
Array(1, 1) =”25″
……

Read the rest of this entry »