แก้ไข

แชร์ผ่าน


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(... cli::array <System::String ^> ^ delimiters);
public void SetDelimiters (params string[]? delimiters);
public void SetDelimiters (params string[] delimiters);
member this.SetDelimiters : string[] -> unit
Public Sub SetDelimiters (ParamArray delimiters As String())

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.

To See
Parse a text file Parsing Text Files with the TextFieldParser Object

Applies to

See also