TextFieldParser.SetDelimiters Method (String[])

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Sets the delimiters for the reader to the specified values, and sets the field type to Delimited.

Namespace:   Microsoft.VisualBasic.FileIO
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

public void SetDelimiters(
	params string[] delimiters
)

Parameters

delimiters
Type: System.String[]

Array of type String.

Exception Condition
ArgumentException

A delimiter is zero-length.

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.

The following table lists an example of a task involving the SetDelimiters method.

To

See

Parse a text file

Parsing Text Files with the TextFieldParser Object (Visual Basic)

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.

.NET Framework
Available since 2.0
Return to top
Show: