I have to develop a simple parser, to read “block” of text
for example:
/TEST
{. text .}
/TEST_DATA
{. infs .}
and, I need to read informations of inside of label….
and… the file with have this informations… have a lot of labels, with the same perfil
for example:
/TEST
{. text .}
/TEST_DATA
{. infs .}
/LBL1
{. text .}
/LBL1_DATA
{. infs .}
/LBL2
{. text .}
/LBL2_DATA
{. infs .}
/LBL3
{. text .}
/LBL3_DATA
{. infs .}
i need to read the block of specif label, for example:
parseFile(“FileName.txt”, LBL1)
and the function, return for me, the text of inside the blocks: LBL1 and LBL1_DATA
or, return for me, the content of LBL1 and LBL1_DATA
I don’t know, how I can do this :xxx
I need help ;x
Thanks.
Assuming data in one-line, here’s a very simple code example.
You need, obviously test it, test it and test it. Looking to your behavior, fixing possible bugs and something that I forgot to do(it’s a work for you now) and so do your new implementations.
UPDATE: a more simple code was written.
I hope this help you.
EDIT #2: I read again your question and seen that you need of below key as well.
Try this:
And then: