c# - StreamWriter ordering using Foreach -


Some text to me that many values ​​such as:

  PartNumber Amount Fid1 blahblahblah 999934109 0603 Exclude Blow 12? 981 Faidiarai Fertekteks 123 Fid 2 Filrtekst 123 Fid Filrtekst 123 0603 Filrtekst 123 0603 Filrtekst 123 0603 Filrtekst 123 0402 Filrtekteks 123 0402 Filrtekst 123 // etc ......... etc ........... Etc. I would like to print the values ​​ "FID"   
  int j = 1; ("FID")} {sw.WriteLine ("{0}: {1} {2} {3}", J, line (such as "line.", Partnumber, line zodiac, line description); J ++ ;}}   

However, when I do them print them:

  1: Fid1 99 9934109 Blahbllah 2: FID5 123 Filrtekst 3: Fid 2123 Filrtekst 4: Fed 123 Filrtekst   

I would like to print them numerical .. like this:

  1: fid 123 Fillertext 2: Fid1 99 9934109 Blahblahblah 3: fid2 123 Fillertext 4: FID5 123 Fillertext   

Is this an easy, fast way to do this?

You probably have a LINQ query commands can use the volume:

  int garbage, line by line from the line. Partonmber. ToUpper (). with starts ( "FID") order (Int32. TryParse (line.PartNumber.Substring (3), garbage))? (Int32.Parse (line.PartNumber.Substring (3))): 0 select line;   

in your foreach If the statement is not required, then, either.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -