TextFieldParser クラスとは? わかりやすく解説

TextFieldParser クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

構造化されたテキスト ファイル解析するためのメソッドおよびプロパティ提供します

名前空間: Microsoft.VisualBasic.FileIO
アセンブリ: Microsoft.VisualBasic (microsoft.visualbasic.dll 内)
構文構文

Public Class TextFieldParser
    Implements IDisposable
Dim instance As TextFieldParser
public class TextFieldParser : IDisposable
public ref class TextFieldParser : IDisposable
public class TextFieldParser implements IDisposable
public class TextFieldParser implements IDisposable
解説解説

詳細については、Visual Basicトピック「TextFieldParser オブジェクト」を参照してください

TextFieldParser オブジェクトは、構造化されたテキスト ファイル解析するためのメソッドおよびプロパティ提供しますテキスト ファイルTextFieldParser解析することによってテキスト ファイル反復処理されますまた、ReadFields使用することによって、テキストからフィールド抽出 (つまり、文字列分割) できます

TextFieldParser では、区切り形式固定幅の 2 種類ファイル解析できます。このオブジェクト公開するプロパティには、区切り形式ファイルでしか意味を持たないもの (DelimitersHasFieldsEnclosedInQuotes など) や、固定幅のファイルでしか意味を持たないもの (FieldWidths プロパティ) があります

Microsoft.VisualBasic.FileIO.TextFieldParser オブジェクト使ったタスクの例を次の表に示します

使用例使用例

この例では、タブ区切りのテキスト ファイル Bigfile解析します

Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser
 _
("c:\logs\bigfile")
    MyReader.TextFieldType = Microsoft.VisualBasic.FileIO.FieldType.Delimited
    MyReader.Delimiters = New String() {vbTab}
    Dim currentRow As String()
    'Loop through all of the fields in the file. 
    'If any lines are corrupt, report an error and continue parsing.
 
    While Not MyReader.EndOfData
        Try
            currentRow = MyReader.ReadFields()
            ' Include code here to handle the row.
        Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
            MsgBox("Line " & ex.Message &
 _
            " is invalid.  Skipping")
        End Try
    End While
End Using

この例は、読み取ったフィールド処理する関数 processFields存在することを前提としています。

継承階層継承階層
System.Object
  Microsoft.VisualBasic.FileIO.TextFieldParser
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
TextFieldParser メンバ
Microsoft.VisualBasic.FileIO 名前空間
TextFieldParser クラス
その他の技術情報
TextFieldParser オブジェクト
TextFieldParser オブジェクトメンバ
TextFieldParser.CommentTokens プロパティ
TextFieldParser.Delimiters プロパティ
TextFieldParser.EndOfData プロパティ
TextFieldParser.ErrorLine プロパティ
TextFieldParser.ErrorLineNumber プロパティ
TextFieldParser.FieldWidths プロパティ
TextFieldParser.HasFieldsEnclosedInQuotes プロパティ
TextFieldParser.LineNumber プロパティ
TextFieldParser.TextFieldType プロパティ
TextFieldParser.TrimWhiteSpace プロパティ
TextFieldParser.Close メソッド
TextFieldParser.PeekChars メソッド
TextFieldParser.ReadFields メソッド
TextFieldParser.ReadLine メソッド
TextFieldParser.ReadToEnd メソッド
TextFieldParser.SetDelimiters メソッド
TextFieldParser.SetFieldWidths メソッド
My.Computer.FileSystem.OpenTextFieldParser メソッド
TextFieldParser オブジェクトによるテキスト ファイル解析
例外トラブルシューティング : Microsoft.VisualBasic.FileIO.TextFieldParser.MalformedLineException


このページでは「.NET Framework クラス ライブラリ リファレンス」からTextFieldParser クラスを検索した結果を表示しています。
Weblioに収録されているすべての辞書からTextFieldParser クラスを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からTextFieldParser クラスを検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「TextFieldParser クラス」の関連用語

TextFieldParser クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



TextFieldParser クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS