• 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: NSString and NSScanner gurus
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString and NSScanner gurus


  • Subject: Re: NSString and NSScanner gurus
  • From: Sherm Pendley <email@hidden>
  • Date: Wed, 26 Feb 2003 21:28:48 -0500

On Wednesday, February 26, 2003, at 08:08 PM, Umed Zokirov wrote:

How can I parse the result of /usr/bin/locate into an Array of NSStrings. I would like to build up an array of paths returned by the /usr/bin/locate utility. What arguments can I apply to my NSScanner or NSString to extract individual pathnames from the output of /usr/bin/locate? I don't exactly know the exact format of the output of this function

Locate prints one pathname per line. Assuming you've already run locate, and captured its output to an NSString named "myString", all you need to do is split the string on newlines, like this:

NSArray *pathList = [myString componentsSeparatedByString: "\n"];

sherm--

UNIX: Where /sbin/init is Job 1.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >NSString and NSScanner gurus (From: Umed Zokirov <email@hidden>)

  • Prev by Date: Re: PBI: tear-off tab items?
  • Next by Date: Re: Why Cocoa (say vs Carbon)
  • Previous by thread: Re: NSString and NSScanner gurus
  • Next by thread: Table View autosave question/pbdevelopment.plist question
  • Index(es):
    • Date
    • Thread