|
strParseRecord |
|
strParseRecord( const rec, // record to parse const mode, // file mode (1) const &fmts[], // field formats (2) var &vals[], // fiels values returned [const nullind]); // null indicators in vals (default=false) Parses an ASCII record. Typically used by database import scripts together with the dax and file libraries. These file modes are supported:
The field formats are records of 2 ... n words. The 1st word is a field type from this list:
The next words are used as:
The data extracted from the record are stored in vals. If nullind is true, the data is arranged in 2 columns (for example data[totFields][2]), where the first (index 0) holds the value and the second (index 1) is the NULL value indicator (true/1 = value is null, false/0 = value is not null). Example:
...
const dataLayout = {
't 20', // article #
't 30', // name
'n 6', // actual stock
'f 3', // currency, ignore
'n 8 2' // price
};
...
var fvals[4];
strParseRecord(
"'1122.344.102.00';'Leather football champion';112;'USD';12.95",
's', dataLayout, fvals)
);
// The result will be:
// fvals[0] = '1122.344.102.00';
// fvals[1] = 'Leather football champion';
// fvals[2] = 112;
// fvals[3] = 12.95;
...
|
||||||||||||||||||||||||||||||
| Copyright © IBK Landquart | Last revision: 27.05.2002 | << Back Top Next >> |