A have the following input string:
string input =
"Ta005000000000000000000Tb001700000000000000000Sa005000000000000000000" +
"Sb002500000000000000000F 00000000000000000I 00000000000000000N" +
" 00000000000000000FS 00000000000000000IS 00000000000000000NS" +
" 00000000000000000";
I need to separate this string into parts, however, the content varies greatly.
Have to let this string into a list like:
[0] "Ta005000000000000000000"
[1] "Tb001700000000000000000"
[2] "Sa005000000000000000000"
[3] "Sb002500000000000000000"
[4] "00000000000000000I"
[5] "00000000000000000N"
[6] "0000000000000000FS"
[7] "0000000000000000IS"
[8] "0000000000000000NS"
[9] "000000000000000000"
The only thing that I know in this case is that the max lenght of the string is 23. So, in this example, I need to separate the 'T' or 'S' of the fisrt part of the string return. Or, if you have no occurrence of these characters, separated by space (it happens on the last part of my string return). I did so:
var linq = test.Split(new[] { 'T', 'S', ' ', '{', '}' }, StringSplitOptions.RemoveEmptyEntries).ToList();
My "test" is a StrintBuilder containing those return characters. By doing this, I can separate my list, but I lost a very important information for me in this case, which is the 'T' and 'S'.
Well, do not know if it was clear, but it seems to be something so simple and is giving me a huge headache.
Obs: Other problem is that, for example: "0000000000000000FS", in this part of string I need to maintain the "FS" together.
Thank you for your attention,