I'm trying to split this string so I get the values of each Title, as in 0, 200, Ownership, France, Mjaquar, Paris and 2300. If you could provide code example how to do this, would help alot!
ID: 0, Price: 2000, Legal Form: Ownership, Country: France, Street: Mjaquar, City: Paris, zip Code: 2300
It seems that Split
ing twice (by comma and then by semicolon) will do
string source = @"ID: 0, Price: 2000, Legal Form: Ownership, Country: France, Street: Mjaquar, City: Paris, zip Code: 2300";
Dictionary<string, string> dict = source
.Split(',')
.Select(pair => pair.Split(':'))
.ToDictionary(pair => pair[0].Trim(),
pair => pair[1].Trim(),
StringComparer.OrdinalIgnoreCase);
// 2000
Console.WriteLine(dict["price"]);