extracting strings from a text file

G

Guest

Hi, I want to extract strings from the following text file content.

*********************
Description length of global graph compressed
using this substructure = 302.907315

Compression = 0.615889

Instances:

instance first vertex: ID label
------------------------------------------
1 37 b
2 29 a
3 32 a

omitted...

***********************************
I try to extract just this part and put each value into a data table.

1 37 b
2 29 a
3 32 a

1, but there are several empty lines and spaces. how can I deal with several
empty line and spaces?
2, how can I split up the line into each value?
(ex) 1 37 b
----->1 for ID
-----> 37 for instID
-----> b for lable

Welcome any help for me, please.
Thanks a lot.

Eunice.
 
C

cody

string line = reader.ReadLine();

string fields[] = line.Split('\t'); // if separator is tab char

int ID = fields[0];
int instID= fields[1];
string lable = fields[2];
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top