Hello all,
i got help by Vulpes in this Thread->
http://www.c-sharpcorner.com/Forums/Thread/205494/string-split-how-to-calculate-slot.aspx
I wanna rewrite the Code from Vulpes, but dont now how to do that with two files.
I have a FIRST File that looks like that: (crap Export i made)
"";"";0
" 09000";"Catalog 1";10148
" 09001";"Catalog 2";20
" 09002";"Catalog 3";166
I have a SECOND File that looks like that:
" 09000";476
" 09001";10
" 09005";5
What to do? the Output file must look like that:
09000~Catalog 1~9672
09001~Catalog 2~10
09002~Catalog 3~161
I need to substract Field 3 from the FIRST File, with Field 2 from the SECOND File and get a Output like above.
Loading
VulpesPosted Apr 8, 2013, 9:57 AM
s hPosted Apr 8, 2013, 8:48 AM
For your Code (just to let u know, i think u know that already, maybe forgoten,
for the rest, Encoding @ Reader must be set like here:
using (StreamReader reader = new StreamReader(@"file", System.Text.Encoding.Default))
For special characters.
Last Question (How to do that)?
I need to output a Third file, that must look like that:
;0
09000;10008
09001;0
09002;166
09003;383
But without the middle "Catalog" and with the spaces at start (15).
Same Input Files.
i tried with that
This comes out:
VulpesPosted Apr 8, 2013, 7:16 AM
s hPosted Apr 8, 2013, 6:45 AM
or should the program allow for the possibility that this may not necessarily be the case?
-> u can do that if u think that is needed..
VulpesPosted Apr 8, 2013, 6:31 AM
Is it safe to assume that there will always be a line in the second file whose stock number corresponds with that in the first file, or should the program allow for the possibility that this may not necessarily be the case?
For example, if file 1 contains a line with 09012, can we be certain that the second file will as well?
s hPosted Apr 8, 2013, 6:23 AM
2.If it get ignored in the First file, it must be ignored in the Second too, what u
see r Stocks columns. Important is that the real Line get substracted, Indiz is the
Number at start.
09000
09001
3. Sry that was a write mistake. should b the same number like in the First File.
(corrected it above)
VulpesPosted Apr 8, 2013, 6:08 AM
1. Can it be assumed that each line in both files will have exactly 3 fields?
2. Should the first line in the second file be ignored or does this only apply to the first file?
3. Does it matter that the 'serial numbers' of the corresponding lines in each file don't match? For example, 10 is being subtracted from 20 even though the serial numbers are 09001 in the first file and 09003 in the second file.