FORMfields


FORMfields.FfParseHelper

Class FfParseHelper

FfParseHelper

public class FfParseHelper

FfParseHelper is a helper class used to parse certain types of data.

Since:
FORMfields v3.0

Method Summary
array

delimitedSplit(char delim, string str, boolean trimValues)

Splits a line of entries by the specified delimiter.

void

parseDelimitedFile(string filename, char delim, boolean winCarriageReturn, boolean trimValues)

Parses a delimited file.

Method Detail

delimitedSplit

public array delimitedSplit(char delim, string str, boolean trimValues)

Splits a line of entries by the specified delimiter. After trial and error it was determined that a character by character processing routine like the following is more effective and contained less bugs then trying to achieve the same result using regular expressions.

Parameters:
delim - a single character delimiter
str - the line of entries to split
trimValues - false or null if the values should not be individually trimmed of whitespace
Returns:
an array of entries, without any wrapping double quotes
Since:
FORMfields v3.0

parseDelimitedFile

public void parseDelimitedFile(string filename, char delim, boolean winCarriageReturn, boolean trimValues)

Parses a delimited file. If delim is null this method will use the file extension to automatically determine the delimiter. Delimiter defaults: .csv = comma, .txt = tab.

Parameters:
filename - path to the delimited file
delim - a single character delimiter
winCarriageReturn - if winCarriageReturn is false then rows are terminated with \r\n and and new lines in a field value can be represented with a single \n. If winCarriageReturn is false then rows are terminated with \n and new lines in a field value CANNOT be represented.
trimValues - false or null if the values should not be individually trimmed of whitespace
Since:
FORMfields v3.0

FORMfields