• 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: Equivalent to the fscanf() C function in Cocoa?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Equivalent to the fscanf() C function in Cocoa?


  • Subject: Re: Equivalent to the fscanf() C function in Cocoa?
  • From: Ondra Cada <email@hidden>
  • Date: Thu, 22 Aug 2002 17:55:24 +0200

On Thursday, August 22, 2002, at 03:26 , Arthur VIGAN wrote:

Is there an equivalent to the C function fscanf() in the Cocoa framework for
an NSString?

Not a close equivalent. As remote ones you might check NSScanner.

The "problem" is that my application generates strings containing int values
separated by a space (for instance: "150 221 14 487 174") that I would like
to put in an array.

NSArray *a=[string componentsSeparatedByString:@" "];

Note if you need NSNumbers, you have to translate them -- this would make an array of strings. For many cases is is sufficient though, since strings understand -intValue.
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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: 
 >Equivalent to the fscanf() C function in Cocoa? (From: Arthur VIGAN <email@hidden>)

  • Prev by Date: Re: Combining Images with text for a TableView cell
  • Next by Date: Deallocating Distributed Objects
  • Previous by thread: Re: Equivalent to the fscanf() C function in Cocoa?
  • Next by thread: Re: Equivalent to the fscanf() C function in Cocoa?
  • Index(es):
    • Date
    • Thread