c# - Formatting the string by rewriting the delimiters -


I am working with some legacy data, where they place each record in a large / large string (a string = a record)

each string, they are divided into delimiters any data, but defines each actually a sense of them, for example: \ vToyota \ cBlue \ cRed \ CWhite \ s200mph \ oAndrew \ oJohn

\ v The vehicle means, \ c is the color, the speed is \ o the owner. Something like this ..

For my work, I need to reformat the data so that if there are too many areas of a specialty, I would have to type it again: (for example) \ vToyota \ cBlue \ c2Red \ c3White \ s200mph \ oAndrew \ o2John

edit: Well @ Darren Yug suggestions work! Now I have an array of vToyota cBlue cRed cWhite s200mph Ondreu ozone. I tested the other data using the same method and it is also working. Now I just need help finding a way to rewrite the first letter of each string

Thanks!

I found this interesting little puzzle to see what I can do with LINQ. Start the following tasks:

  private string Fiksit (string Foo) {var newFoo = "\\" + string.Join ( "\\", [foo.Split (new] { ' \\ '}, string Split objects. Nikalenaktiiants. Group by (S = & gt; S [0], (C, G) = & gt; {var cnt = 0; return g.Select (x = & gt; cnt ++ == 0? X: X [0] + cnt.ToString () + x.Substring (1));}) .SelectMany (G = & gt; G)); new return;} input: \ vToyota \ cBlue \ cRed \ cWhite \ s200mph \ oAndrew \ oJohn output: \ vToyota \ cBlue \ c2Red \ c3White \ s2mph \ o Andrew \ o2John   

to the SelectMany Remember There is an easy thing to do.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -