• 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
Number in NSString to int.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Number in NSString to int.


  • Subject: Number in NSString to int.
  • From: Adam Penny <email@hidden>
  • Date: Fri, 31 Oct 2008 21:38:19 +0100

Hi there,

I'm trying to process a MAC Address into Hex so I was going to do something like.

NSArray *macArray=[[NSArray alloc] init];
macArray=[mac componentsSeparatedByString:@":"];
for (int i=0; i < [macArray count] ; i++)
{
//somehow need to get an int called dec from the number in the NSString then...
NSString *hex=stringWithFormat:@"%x",dec;
[macArray[i] autorelease];
macArray[i]=hex;


	}

My main question is how to get an int from an NSString, but also, if you could have a look at the rest of the contents of the for loop I'd be grateful as I'm sure I'm making a pigs ear of the memory management there. Sort of had a feeling that it would be autorelease as I thought that the substrings in the array would be the responsibility of the array rather than me, but other than that I was a bit boggled.

Thank you all.

Adam
_______________________________________________

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: Number in NSString to int.
      • From: "I. Savant" <email@hidden>
  • Prev by Date: Re: Detecting when NSComboBox text changed by list
  • Next by Date: Re: Number in NSString to int.
  • Previous by thread: NSArrayController and Auto Rearrange Content
  • Next by thread: Re: Number in NSString to int.
  • Index(es):
    • Date
    • Thread