March 2014 update
This commit is contained in:
parent
09687c4926
commit
a25938f123
1846 changed files with 21876 additions and 5203 deletions
8
Task/Search-a-list/Objective-C/search-a-list.m
Normal file
8
Task/Search-a-list/Objective-C/search-a-list.m
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
NSArray *haystack = @[@"Zig",@"Zag",@"Wally",@"Ronald",@"Bush",@"Krusty",@"Charlie",@"Bush",@"Bozo"];
|
||||
for (id needle in @[@"Washington",@"Bush"]) {
|
||||
int index = [haystack indexOfObject:needle];
|
||||
if (index == NSNotFound)
|
||||
NSLog(@"%@ is not in haystack", needle);
|
||||
else
|
||||
NSLog(@"%i %@", index, needle);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue