Here are 2 records in are sample string, the “|” indicates a new record or row
a “,” separates the pairs and a “=” separates the key from the value. The code below would work if it were a single row or record but not for many rows or in this case 2 rows.
What is needed to have this work so that I get 2 rows with 3 elements each?
string s1 = "colorIndex=3,font.family=Helvicta,font.bold=1|colorIndex=7,font.family=Arial,font.bold=0";
string[] t = s1.Split(new[] { '(', ')' }, StringSplitOptions.RemoveEmptyEntries);
Dictionary<string, string> dictionary =
t.ToDictionary(s => s.Split('=')[0], s => s.Split('=')[1]);
Try this: