TextFieldParser.SetDelimiters(String[]) Method

Definition

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

public void SetDelimiters (params string[]? delimiters);
public void SetDelimiters (params string[] delimiters);

Parameters

delimiters
String[]

Array of type String.

Exceptions

A delimiter is zero-length.

Examples

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.

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.

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

Applies to

Product Versies
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also