Here's an example of a message:
User: tbone
Location: /whatever
Time: 23:23:23
This is a little message.
It's sort of HTTP- and other protocols-ish: headers followed by a blank line and the message body.
What's the easiest pretty efficient way to parse this? The standard text/scanner looks good to me. It would be very easy for me to use if I could deal with whitespace a little better. Namely, in the headers, it should ignore whitespace surrounding a colon, but let me know about spaces between words and newlines. I also need to know when the message body starts.
Might a scanner be the right tool for the job? Is there a better strategy? Should I just write my own little parser that marches along a character (or sometimes two) at a time and builds up my data structure? That's the kind of inconvenience I'd like to avoid, but I could do that.
By the way, I control the message format. Is there a better message format that would simplify the task?