Difference between revisions of "ParseCsvText"
Line 2: | Line 2: | ||
[[Category:Doc Status D]] <!-- For Lumina use, do not change --> | [[Category:Doc Status D]] <!-- For Lumina use, do not change --> | ||
− | = ParseCsvText(text'', linesep,colsep'') = | + | == ParseCsvText(text'', linesep, colsep'') == |
− | Reads and parses tabular | + | Reads and parses tabular «text», in the format known as a CSV (for "Comma-Separated Values") format, in which data is arranged in columns on separate lines, and in which the first line contains column labels. |
− | Normally columns are separated by commas, although the optional | + | Normally columns are separated by commas, although the optional «colsep» parameter can be specified if a different separation string is used. |
− | An array of text values is returned, indexed by two local indexes, Row and Field. Typically some columns may contain text, others numbers, and other dates. You must post-process the result returned from | + | An array of text values is returned, indexed by two local indexes, <code>Row</code> and <code>Field</code>. Typically some columns may contain text, others numbers, and other dates. You must post-process the result returned from [[ParseCsvText]] using, for example, [[ParseDate]] and [[ParseNum]] to convert the text columns to numeric values. The <code>Row</code> index contains the column labels. |
The data within a column in the file must never contain the separator strings. | The data within a column in the file must never contain the separator strings. | ||
− | To use this function with tab-delimited data, use | + | To use this function with tab-delimited data, use <code>ParseCsvText(text, colsep: Chr(9))</code> |
− | |||
− | = Library = | + | == Library == |
− | + | Flat File <code>Library.ana</code> | |
− | Flat File Library.ana | ||
(Use '''File → Add Library...''' to add this library) | (Use '''File → Add Library...''' to add this library) | ||
− | = Example = | + | == Example == |
− | |||
For an example, see [[ReadCsvFile]]. | For an example, see [[ReadCsvFile]]. | ||
− | = See Also = | + | == See Also == |
− | |||
* [[ReadCsvFile]] | * [[ReadCsvFile]] | ||
− | * [[ParseNum]] | + | * [[ParseNum]] |
+ | * [[ParseDate]] |
Revision as of 22:41, 14 January 2016
ParseCsvText(text, linesep, colsep)
Reads and parses tabular «text», in the format known as a CSV (for "Comma-Separated Values") format, in which data is arranged in columns on separate lines, and in which the first line contains column labels.
Normally columns are separated by commas, although the optional «colsep» parameter can be specified if a different separation string is used.
An array of text values is returned, indexed by two local indexes, Row
and Field
. Typically some columns may contain text, others numbers, and other dates. You must post-process the result returned from ParseCsvText using, for example, ParseDate and ParseNum to convert the text columns to numeric values. The Row
index contains the column labels.
The data within a column in the file must never contain the separator strings.
To use this function with tab-delimited data, use ParseCsvText(text, colsep: Chr(9))
Library
Flat File Library.ana
(Use File → Add Library... to add this library)
Example
For an example, see ReadCsvFile.
Enable comment auto-refresher