Friday, June 27, 2014

Iphone Array of strings and searching particular string - NSMutableArray

Usage
NSMutableArray *myArray = [NSMutableArray array];
[myArray addObject:@"first string"]; // same with float values
[myArray addObject:@"second string"];
[myArray addObject:@"third string"];
int i;
int count;
for (i = 0, count = [myArray count]; i < count; i = i + 1)
{
   NSString *element = [myArray objectAtIndex:i];
   NSLog(@"The element at index %d in the array is: %@", i, element); // just replace the %@ by %d
}



Search
return [theArray indexOfObject:@"ipod"];

No comments:

Post a Comment