• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: parsing string data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >parsing string data (From: "C Sandeep" <email@hidden>)
 >Re: parsing string data (From: j o a r <email@hidden>)

  • Prev by Date: Re: parsing string data
  • Next by Date: NSTask's launchedTaskWithLaunchPath:arguments: versus NSWorkspace's launchApplication:
  • Previous by thread: Re: NSTextField Size
  • Next by thread: "Helper" applications
  • Index(es):
    • Date
    • Thread