I have searched for an answer to this, and one may exist, but I'm not quite sure of the right terms to use to find it, so...
I am interested in trying to put a fairly unstructured buffer of data (actually a large widestring) into a record, so I can selectively use certain parts of the string data, but not all of it.
The raw data string (lets call it MyRawData) contains many values that can be of varied length, seperated only by a CRLF (0x0D0A), so there's no ':' or ',' etc. For example :
Name Peter Pan
Age 25
Street My Great Street
Town My Awesome Town
County Some County
Country UK
Occupation Some Career
What I would like to do in one part of my program, instead of seeing the entire content of MyRawData is :
MyData.Name
MyData.Address
MyData.Occupation
but not use the rest. And somewhere else I might want to use the rest, or some of it :
MyData.Age
MyData.County
MyData.Country
I am not sure, though, how to ensure the right parts of the data string (MyRawData) go into the right part of the record (MyData) when they can be of varied length, with one or more space char, and only a CRLF to seperate the values? I'm sure it is possible, but I am not sure how. In other words, how do you "parse" an unpredictable string of data and break it into individual records that may only need to hold 2 or 3 characters, or many? Can anyone help?