Dear ALL,
Thank you very much for the many suggestions! I am fairly amazed by the repercussion of my humble question.
Unfortunately, the suggestions by @bytebites and @Roland57, clear as they are, lack in generality because they assume the substrings have fixed positions along the string, which they do not. For exemple, I can have strings as:
S1 := '13(23)(01)-002000201000000(01)020(01)0020000020010100202-00-00(01)00022(234)1??01?????????1?3?2?????????';
or
S2 := '13(0123)(02)000210(01)00110000000201013000002(01)200120004010-10000020(12)1120221121123010302101113002';
(Notice that the delimited substrings can be more than two characters in length).
The solution by @winni seems to deal with all these situations, but I have not yet tested it.
Now, let me take this opportunity to explain in a little bit more detail what I want to do:
I need to run along these strings, getting each character and storing it into a stringlist. However, the substrings delimited by '(' and ')' should be treated as a
single 'character' and stored together.
For example, if the original long string is:
S := '1110-00(12)1000011000000020(01)02(12)0000020300100204020-0000002021122222010023013322101002000';
I should have the characters stored into a stringlist as:
Slist.Add('1');
Slist.Add('1');
Slist.Add('1');
Slist.Add('0');
Slist.Add('-');
Slist.Add('0');
Slist.Add('0');
Slist.Add('12');
... and so on.
It looks like I can achieve that with the solution proposed by @winni, but I have not tried it as yet.
Again, thank you very much for the many suggestions!
Cheers,