TextFieldParser.SetDelimiters Method
Sets the delimiters for the reader to the specified values, and sets the field type to Delimited.
' Usage
TextFieldParserObject.SetDelimiters(delimiters)
' Declaration
Public Sub SetDelimiters( _
ByVal delimiters As String() _
)
Parameters
- delimiters
Array of type String.
Exceptions
The following condition may cause an exception to be thrown.
- A delimiter is zero-length (ArgumentException).
Remarks
The existing contents of the Delimiters property are cleared when this method is set.
This method provides a way to set delimiters without creating an array.
Tasks
The following table lists an example of a task involving the SetDelimiters method.
To |
See |
---|---|
Parse a text file |
Example
This example opens a text field parser and defines the delimiter as vbTab.
Using FileReader As New _
Microsoft.VisualBasic.FileIO.TextFieldParser("C:\logs\test.log")
FileReader.SetDelimiters(vbTab)
End Using
Replace the path C:\logs\test.log with the path and name of the file you wish to parse.
Requirements
Namespace:Microsoft.VisualBasic.FileIO
Class:TextFieldParser
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)
Permissions
No permissions are required.
See Also
Tasks
How to: Read From Comma-Delimited Text Files in Visual Basic
Concepts
Parsing Text Files with the TextFieldParser Object