Click here to Skip to main content
16,004,927 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to create progress bar Pin
Anthony Mushrow24-Oct-07 6:50
professionalAnthony Mushrow24-Oct-07 6:50 
AnswerRe: How to create progress bar Pin
solutionsville24-Oct-07 9:42
solutionsville24-Oct-07 9:42 
QuestionAligning WinForm Pin
Fayu24-Oct-07 5:37
Fayu24-Oct-07 5:37 
AnswerRe: Aligning WinForm Pin
Justin Perez24-Oct-07 5:42
Justin Perez24-Oct-07 5:42 
AnswerRe: Aligning WinForm [modified] Pin
Kristian Sixhøj24-Oct-07 5:42
Kristian Sixhøj24-Oct-07 5:42 
GeneralRe: Aligning WinForm Pin
Fayu24-Oct-07 6:12
Fayu24-Oct-07 6:12 
GeneralRe: Aligning WinForm Pin
Kristian Sixhøj24-Oct-07 6:30
Kristian Sixhøj24-Oct-07 6:30 
Questionlooking for better way for parsing [modified] Pin
stephan_00724-Oct-07 4:38
stephan_00724-Oct-07 4:38 
hy everyone!

i want to parse a file which contains a lot of info, some info is not necessary for my application but some is. so i have to look for this kind of information by parsing the file and extract it. i found a solution for my problem but i am not very happy with it.

my lines start either with f or d where f is for format and d is for data. the f line describes where which info could be found in the d line which follows. e.g.

fname,address,postalcode,city,phone,fax
dsmith|new street 11|1234|new town|123456|234567

now i want to extract lets say the phone number. lets say i do have 20 lines like above which should be parsed one by one. my problem ist i can't just search for phone, because first i will get more than one hit and second i have to know the index, meaning where it is located in the f-line to find the data in the d-line. i do only want to extract the data which can be found in the d-lines, the f-lines are only there to get the index where the data is stored in the line. (it's always a f-line - d-line combination in the whole file. so some kind of valuestrings).

i could read line by line out of the file and check if a token is in it. if it is not then the line is of no interest, if there is then i have to tokenize it. but what if i want to extract more than one info? lets say i want to extract phone than it is quit simple, but what if token1 is in it and token2 isn't (for what reason ever) and it is the token i used to search for? normally every line should look the same so i could just use one which is in there for sure.

example
fone,two,three,four
d1,2,3,4
ftwo,three,four,five
d2,3,4,5
fname,address,postalcode,city,phone,fax
dsmith|new street 11|1234|new town|123456|234567
fname,address,postalcode,city,phone,fax
dsmith1|new street 121|12324|new town|1232456|2234567
fname,address,postalcode,city,fax <=
dsmith2|new street 131|12334|new town|2334567 <=
ffoo,foo2,foo3,foo4
d1,2,3,4
ffoo2,foo3,foo4,foo5
d2,3,4,5

so with my current solution i would search for a line with phone in it, then split the info by tokenizing it and extract the data. but if the entry is no longer in it (see line with <=) i am lost and have to change the algorithm. does someone of you have a better solution how to find the line or even to realize it is a line which is worth tokenizing (because lines with data of no interest should be left behind because of performance reasons!).

i hope i was able to describe my problem well enough so you could get the gist of what my current problem looks like. Smile | :)

thanks.
stephan.


-- modified at 10:53 Wednesday 24th October, 2007
AnswerRe: looking for better way for parsing Pin
Justin Perez24-Oct-07 5:01
Justin Perez24-Oct-07 5:01 
QuestionC#, Generic Methods and Common Data Types Pin
Alexandre G24-Oct-07 4:09
Alexandre G24-Oct-07 4:09 
AnswerRe: C#, Generic Methods and Common Data Types Pin
TJoe24-Oct-07 4:23
TJoe24-Oct-07 4:23 
Questionan update problem Pin
Seraph_summer24-Oct-07 3:14
Seraph_summer24-Oct-07 3:14 
AnswerRe: an update problem Pin
Anthony Mushrow24-Oct-07 3:50
professionalAnthony Mushrow24-Oct-07 3:50 
GeneralRe: an update problem Pin
Seraph_summer24-Oct-07 3:58
Seraph_summer24-Oct-07 3:58 
AnswerRe: an update problem Pin
c0ax_lx24-Oct-07 4:10
c0ax_lx24-Oct-07 4:10 
GeneralRe: an update problem Pin
Seraph_summer24-Oct-07 4:19
Seraph_summer24-Oct-07 4:19 
GeneralRe: an update problem Pin
Seraph_summer24-Oct-07 4:34
Seraph_summer24-Oct-07 4:34 
GeneralRe: an update problem Pin
c0ax_lx24-Oct-07 4:37
c0ax_lx24-Oct-07 4:37 
GeneralRe: an update problem Pin
Seraph_summer24-Oct-07 4:44
Seraph_summer24-Oct-07 4:44 
GeneralRe: an update problem Pin
c0ax_lx24-Oct-07 8:23
c0ax_lx24-Oct-07 8:23 
GeneralRe: an update problem Pin
Seraph_summer24-Oct-07 21:37
Seraph_summer24-Oct-07 21:37 
QuestionHow to enable/disable(install/uninstall) serial port in C#? [modified] Pin
nasif400324-Oct-07 3:07
nasif400324-Oct-07 3:07 
AnswerRe: How to enable/disable(install/uninstall) serial port in C#? Pin
ScottM124-Oct-07 4:12
ScottM124-Oct-07 4:12 
QuestionWhat is the proper way to send emails? Pin
Tomz_KV24-Oct-07 2:50
Tomz_KV24-Oct-07 2:50 
AnswerRe: What is the proper way to send emails? Pin
Anthony Mushrow24-Oct-07 2:56
professionalAnthony Mushrow24-Oct-07 2:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.