Suppose there is a text file containing these in the fallowing style:
name: natalie, sarah
surname: parker
age: 24
contry: dubai
I want to get natalie
and sarah
as the name, parker
as the surname and so on. After this, somewhere in my code I need variables name, surname, age (as natalie, sarah, parker, 24 etc..).
I think, first I need to read file and store it in an array and than parse it with using delimiters which are : " "(space) or ":" in order to parse <surname: parker>
this one, and also use "," comma as a delimiter in order to parse <natalie, sarah>
.
I could store the text in an array or use getline(textfile, size) for getting the lines, because I need exactly one line in each time. Which is the most suitable do you think? And how we can do the parsing?