TextFieldParser Object Members
The TextFieldParser object provides methods and properties for parsing structured text files as shown in the following table.
Properties
String. Lines beginning with the specified comment token are skipped by the parser. |
|
String. The delimiters for the text file. Valid only for delimited files. |
|
Boolean. Returns True if there are no non-blank, non-comment lines between the current cursor position and the end of the file. |
|
String. Returns the line that caused the most recent MalformedLineException. Default is "". |
|
Long. Returns the line number that caused the most recent MalformedLineException. Default is -1. |
|
Integer. Denotes the width of each column in the text file. Valid only for fixed-width files. |
|
Boolean. Returns True if fields can be enclosed in quotation marks. Valid only for delimited files. Default is True. |
|
Integer. Returns the current line number, or -1 if no more characters are available. |
|
FieldType. The type of file, delimited or fixed-width. Default is Delimited. |
|
Boolean. Indicates whether leading and trailing white spaces should be trimmed from field values. |
Methods
Closes the underlying stream. |
|
Reads the specified number of characters without advancing the cursor. |
|
Reads all fields on the current line, returns them as an array of strings, and advances cursor to the next line. |
|
Returns the current line as a String and advances the cursor to the next line. |
|
Reads the remainder of the stream and returns it as a String. |
|
Sets the delimiters for the reader to the specified values and the field type to Delimited. |
|
Sets the delimiters for the reader to the specified values and the field type to FixedWidth. |
See Also
Concepts
Parsing Text Files with the TextFieldParser Object