You can divide by a comma and then by an equal sign. I put the data in a dictionary for easy access.
string input = "StudentId=J1123,FirstName=Jack,LastName=Welch";
Dictionary<string,string> keyValuePairs = input.Split(',')
.Select(value => value.Split('='))
.ToDictionary(pair => pair[0], pair => pair[1]);
string studentId = keyValuePairs["StudentId"];
Note that this does not check input at all to ensure that there are no commas in the values, keys without values, missing keys, etc.
Servy source
share