• 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
Converting NSArray of NSString elements into binary?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Converting NSArray of NSString elements into binary?


  • Subject: Converting NSArray of NSString elements into binary?
  • From: "R.L. Grigg" <email@hidden>
  • Date: Mon, 1 Oct 2007 16:28:19 -0700

Newb Cocoa question:

I have many lines of textual ascii data in a file that i need to scan into a NSData as binary:
000 255 127 255 066 033 127 000 221 ...
This data can go for more than 1000 values per line.


Currently I read each line into a NSString and parse the data into a NSArray:
NSString *list = @"000 255 127 255 066 033 127 000 221 ..."; // example data
NSArray *listItems = [list componentsSeparatedByString:@" "];


Is there some method to convert the NSArray of NSString elements into binary byte values? Or do I have to go through each element and convert each NSString into a NSNumber so I can put it's byteValue into a NSMutableData one by one? Is this the wrong approach?

Russ

_______________________________________________

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


  • Follow-Ups:
    • Re: Converting NSArray of NSString elements into binary?
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: NSButton Behaviors
  • Next by Date: Re: How can we draw a NSWindow in a custom NSView?
  • Previous by thread: Re: NSButton Behaviors
  • Next by thread: Re: Converting NSArray of NSString elements into binary?
  • Index(es):
    • Date
    • Thread