Re: parsing string data
Re: parsing string data
- Subject: Re: parsing string data
- From: j o a r <email@hidden>
- Date: Thu, 20 Dec 2007 09:19:28 -0800
On Dec 20, 2007, at 8:47 AM, C Sandeep wrote:
Thanks. I think I will take the NSScanner route. From the apple doc
examples, it wasn't clear how to acheive my objective. Can you give
me a hint. Thanks.
NSScanner works by linearly searching through a string for sequences
of characters, and optionally also extracting values of different
types as it goes along. You would have to use your knowledge about the
format of the data that you're parsing to use NSScanner correctly. You
don't configure a scanner object and then have it return all the data
that you're looking for in one go, instead you use the scanner to step-
by-step, "manually", search through the string for each individual
part of the data set that you're looking for.
In your example it might help to break the string up on rows first, to
more easily parse out the message type and the headers.
Some of the sample code that ships with the dev tools uses NSScanner,
you might find something of interest:
$ mdfind -onlyin /Developer/Examples -interpret NSScanner
There is also a bit of documentation here:
<http://developer.apple.com/documentation/Cocoa/Conceptual/Strings/Articles/Scanners.html
>
Another good place to search for sample code is Google Code Search:
<http://www.google.com/codesearch>
j o a r
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden