Posted Post

Posted People, Posted Life.

Archive for August, 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 »

Basic ASP RegExp Regular Expression Functions

These are my basic ASP Functions about regular expressions, very handy and powerful, for the Ancient ASP Technology.

List of Variables Representing Arguments

VStr, vStr2, vStr3 ….: the string

vPattern: the regular expression pattern, basic syntax at the bottom.

Function: Check Regular Expression Match

Function kCheckRegExp(vPattern, vStr)

Dim oRegExp

Set oRegExp = New RegExp

oRegExp.Pattern = vPattern

oRegExp.IgnoreCase = True

kCheckRegExp = oRegExp.Test(vStr&”")

Set oRegExp = Nothing

End Function Read the rest of this entry »