2

次のようなヘッダーなしの詳細を含むテキストファイルがあります

 Name1 Text1 This is the message1
 Name2 Text2 This is the message2

こんな風に使えば..

string[] allLines = File.ReadAllLines("TextFile.log");
for (int i = 0; i < allLines.Length; i++
{
    string[] items = allLines[i].Split(new char[] { ' ' });
    MessageBox.Show("This is Name field : " + items[0])      
    MessageBox.Show("This is Text field : " + items[1])      
    MessageBox.Show("This is Message field : " + items[2])      
}

上記のコードを使用すると、最初の 2 つのフィールドは正常に機能しますが、3 番目の列「This is the message1」を 1 列で取得するにはどうすればよいですか?

4

1 に答える 1