Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Number in NSString to int.



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.