Read File and get specific text from line
Read File and get specific text from line
(OP)
Hellow again,
I need to read a file(.txt) and get a particular row. the file containes a sngle row per order shipped.
This an sample of how the data looks. For this sample file I need to read the text file by using the tracking number 848257570000106 and when it findthe row with the tracking number I want either
A) the entire row or
B) the value between "1528," and "1596",
In this example I would either need the entire line or 706
The end user woud supply an order number in a windows form which will populate the tracking numbers in a dropdown box for this orders packages. He will select a tracking number and this is the value that will be searched in the text file.
is this possible nad if so what would be the best way to do it. I am alos open to other sugegstion on how I cna get ths value from the text file
Thanks in advance
RJL
I need to read a file(.txt) and get a particular row. the file containes a sngle row per order shipped.
This an sample of how the data looks. For this sample file I need to read the text file by using the tracking number 848257570000106 and when it findthe row with the tracking number I want either
A) the entire row or
B) the value between "1528," and "1596",
In this example I would either need the entire line or 706
CODE -->
'0,"120"1,"MPS Ship"10,"344002738"29,"848257570000080"34,"660"35,"46"1528,"325"1596,"0"1598,""'
'0,"120"1,"MPS Ship"10,"344002738"29,"848257570000093"34,"265"35,"46"1528,"362"1596,"0"1598,""'
'0,"120"1,"MPS Ship"10,"344002738"29,"848257570000106"34,"879"35,"46"1528,"706"1596,"0"1598,""'
'0,"120"1,"MPS Ship"10,"344002738"29,"848257570000128"34,"155"35,"46"1528,"952"1596,"0"1598,""'
'0,"120"1,"MPS Ship"10,"344002738"29,"848257570000134"34,"681"35,"46"1528,"574"1596,"0"1598,""'
The end user woud supply an order number in a windows form which will populate the tracking numbers in a dropdown box for this orders packages. He will select a tracking number and this is the value that will be searched in the text file.
is this possible nad if so what would be the best way to do it. I am alos open to other sugegstion on how I cna get ths value from the text file
Thanks in advance
RJL
RE: Read File and get specific text from line
sounds pretty straight forward.
How abou something like this:
CODE
Would that do it?
Cheers,
MakeItSo
“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
RE: Read File and get specific text from line
not be extended to string mycode = line.Substring(line.IndexOf("1528,\"") + 5, line.IndexOf("\"1596"));
and thus negate the need for the two Trim statements.
I don't have c# on this machine so I can't check, but it seems a simpler approach to me.
RE: Read File and get specific text from line
“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
RE: Read File and get specific text from line
“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.