Difference between revisions of "ParseCsvText"

 
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Category:Database Functions]]
 
[[Category:Database Functions]]
 +
[[Category: Flat File library functions]]
 
[[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 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.
+
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.   
+
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 ReadCsvFile using, for example, [[ParseDate]] and [[ParseNum]] to convert the text columns to numeric values.  The Row index contains the column labels.
+
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>
ParseCsvText(text,colsep:[[Chr]](9))
 
  
= Library =
+
== Library ==
 +
[[media:Flat File Library.ana|Flat File Library.ana]]
  
Flat File Library.ana
+
:(Use [[File menu|File]] &rarr; '''Add Library...''' to add this library)
 
 
(Use '''File &rarr; Add Library...''' to add this library)
 
 
 
= Example =
 
  
 +
== Example ==
 
For an example, see [[ReadCsvFile]].
 
For an example, see [[ReadCsvFile]].
  
= See Also =
+
== See Also ==
 
+
* [[media:Flat File Library.ana|Flat File Library.ana]]
 
* [[ReadCsvFile]]
 
* [[ReadCsvFile]]
* [[ParseNum]], [[ParseDate]]
+
* [[WriteCsvFile]]
 +
* [[ParseNum]]
 +
* [[ParseDate]]
 +
* [[Parsed Expressions]]
 +
* [[Text functions]]

Latest revision as of 20:23, 24 May 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 FileAdd Library... to add this library)

Example

For an example, see ReadCsvFile.

See Also

Comments


You are not allowed to post comments.