How do I parse a string in C# to extract key-value pairs without any delimiters between key and value?
I have a string that looks like this
string str = "\nFIRSTNAMEJOHN\nLASTNAMESMITH\nADDRESS1590 GRACE STREET\nBIRTHDATE04201969"
After splitting on \n I get a collection of strings that looks like
string[] properties = ["FIRSTNAMEJOHN","LASTNAMESMITH", etc.]
I want to loop through the split array of these strings and extract the key-value pair from each individual string, so that I can populate the properties of an object such as...
Person person = new Person()
{ FIRSTNAME = JOHN,
LASTNAME = SMITH,
etc...
}
What is the cleanest way of doing this? Thanks!