The below is a CSV string I am working with. Its much bigger in reality but this is enough to display a pattern.
Please note that I have put this CSV on seperate lines just to demonstrate my pattern easily.
After a CSV split the number of fields are variable depending on how big the original string is i.e. the string is a variable length which makes the number of indexes variable
The letter in the pattern may not always be P, it could be U, O or F
G9999999990001800002777107050,
G9999999990002777107HMNLAQKPRLLHRAQRWJ010,
1,
3,
29,
P,
6.74,
11.23,
07,
U,
5.25,
14.29,
08,
O,
6.89,
16.92,
07,
P,
5,
4,
I want to pick up the 5th (29) and 6th (P) elements and then miss 2 elements and then pick the next element (07) and the one after (P) and so on until I get to the end of the string.
In this example I will have
29
P
07
P
08
P
07
P
Is there an easy way to do this, I assume LINQ will offer something
Thanks
A full demo on http://ideone.com/EDof0
Output: