We have a requirement to parse string (this string is coming by reading some file) in such a way that if its start/end (e.g. --Abc Start -- Abc End) with some specific string then all lines between those two should be stored in String list say s1 and rest in other String say s2. Want to solve this problem by using design patterns
123
456
--Abc Start
xyz
pqr
-- Abc End
789
101
--Abc Start
mno
efg
-- Abc End
So lines below should be stored in String list s1
s1[0]
xyz
pqr
s2[1]
mno
efg
And lines below should be stored in String s2
123
456
789
101
Tomorrow some other requirement might come to store specific line in different string or in string list.
thanks in advance
regards Amit.
Aucun commentaire:
Enregistrer un commentaire