I have a text file which look like this:
Name:John
Age:18
Info:(text message)
Name:May
Age:17
Info:(text message)
Name:Jane
Age:17
Info:(text message)
I want to make Name, Age, Info in 1 group. Thus, I make the string like this by the code below,
Name:John,Age:18,Info:(text message)
Name:May,Age:17,Info:(text message)
Name:Jane,Age:17,Info:(text message)
However, the sequence will get disturb if the 'info' part have a long message and go into second line.
<pre>Name:John
Age:18
Info:(text message)
Name:May
Age:17
Info:(text................................
....................................message)
Name:Jane
Age:17
Info:(text message)
Any suggestion if I want to group them with specified word(Name, Age, Info)? So that it would not get disturb when the text message is long.
What I have tried:
string[] lines = myInputString.Split(new[] { "\r\n" }, StringSplitOptions.None);
for (int i = 0; i < lines.Count(); i = i + 3)
{
var res = string.Join(",", lines.Skip(i).Take(3));
}