is it possible to convert Array objects into integer values?

Hi.......every one


one NSMutableArray containing elements

now i covert mutablearrayobjects into integer values

how?

Thanks Inadvance:)

iPhone 5, Mac OS X (10.7.3)

Posted on Mar 5, 2013 4:10 AM

Reply
10 replies

Mar 6, 2013 7:43 AM in response to Srikanth from Tenali

No need to go through all that @n is a short circuit that will create an interger object initilized to n just as @"abc" is a short circut to create a string object initilized to the string abc.


So change NSMutableArray *keyArray = [NSMutableArray arrayWithObjects:@"1",@"2",@"3",@"4",@"5", nil];

to


NSMutableArray *keyArray = [NSMutableArray arrayWithObjects:@1,@2,@3,@4,@5, nil];


wil do what you are looking for.

Mar 7, 2013 6:12 AM in response to Srikanth from Tenali

Srikanth from Tenali wrote:


Thank You Mr.Frank Caggiano

for calculation purpose i am asking

Ok then

NSMutableArray *keyArray = [NSMutableArray arrayWithObjects:@1,@2,@3,@4,@5, nil];


creates an array of integer objects. the @n is just a faster way of creating and interger object initialized to the value n. It will work the same as doing the long form.


regards

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

is it possible to convert Array objects into integer values?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.