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)
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)
What type of objects are in the array?
NSMutableArray *keyArray = [NSMutableArray arrayWithObjects:@"1",@"2",@"3",@"4",@"5", nil];
but i want to store 1,2,3,4,5 insted of storing @"1"
,@"2",@"3",@"4",@"5", nil];
after that i add two objects
Easy.
Use NSNumber; this will wrap the number inside an object.
For example:
NSMutableArray *keyArray = [NSMutableArray arrayWithObjects:[NSNumber numberWithInt:1], [NSNumber numberWithInt:2],[NSNumber numberWithInt:3], [NSNumber numberWithInt:4], [NSNumber numberWithInt:5], nil];
Thank You Friend:)
is it possible to ctreate NSNumber Array & Pass these object for storing in arrays.
& i have another dicussion & that i already post in the forum(https://discussions.apple.com/thread/4865446)
please help me
Thanks Inadvance
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.
Better still!
Thank You Mr.Frank Caggiano
for calculation purpose i am asking
Thanks Mr.Michael
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
OK Thank YOU Frank Caggiano
is it possible to convert Array objects into integer values?