Number in NSString to int.
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