TextFieldParser.SetFieldWidths(Int32[]) 메서드

정의

지정한 값에 대한 판독기의 구분 기호를 설정합니다.

public:
 void SetFieldWidths(... cli::array <int> ^ fieldWidths);
public void SetFieldWidths (params int[]? fieldWidths);
public void SetFieldWidths (params int[] fieldWidths);
member this.SetFieldWidths : int[] -> unit
Public Sub SetFieldWidths (ParamArray fieldWidths As Integer())

매개 변수

fieldWidths
Int32[]

Integer의 배열입니다.

예제

다음은 텍스트 필드 파서가 열리고 필드 너비를 로 5정의하는 예제입니다.

Using FileReader As New Microsoft.VisualBasic.FileIO.
    TextFieldParser("C:\logs\test.log")

    FileReader.SetFieldWidths(5)
End Using

경로를 C:\logs\test.log 구문 분석하려는 파일의 경로 및 이름으로 바꿉니다.

다음 예제에서는 텍스트 필드 파서가 열리고 필드 너비를 , 10및 변수로 5정의합니다.

Using MyReader As New Microsoft.VisualBasic.FileIO.
    TextFieldParser("C:\logs\test.log")

    MyReader.SetFieldWidths(5, 10, -1)
End Using

경로를 C:\logs\test.log 구문 분석하려는 파일의 경로 및 이름으로 바꿉니다.

설명

설정되면 속성의 Delimiters 기존 콘텐츠가 지워집니다.

이 메서드는 배열을 만들지 않고 구분 기호를 설정하는 방법을 제공합니다.

다음 표에는 메서드와 관련된 작업의 예가 SetFieldWidths 나와 있습니다.

대상 참조 항목
텍스트 파일을 구문 분석합니다. TextFieldParser 개체를 사용하여 텍스트 파일 구문 분석

적용 대상

추가 정보