Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
29
Task/Search-a-list/FutureBasic/search-a-list.basic
Normal file
29
Task/Search-a-list/FutureBasic/search-a-list.basic
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
window 1, @"Search a list"
|
||||
|
||||
void local fn MyEnumeratorCallback( array as CFArrayRef, obj as CFTypeRef, index as NSUInteger, stp as ^BOOL, userData as ptr )
|
||||
if ( fn StringIsEqual( obj, userData ) )
|
||||
print obj;@" found at index ";index
|
||||
*stp = YES// stop enumeration
|
||||
end if
|
||||
if ( index == 0 ) then print userData;@" not found"
|
||||
end fn
|
||||
|
||||
void local fn DoIt
|
||||
CFArrayRef haystack = @[@"Mike",@"Bravo",@"Tango",@"Uniform",@"Golf",
|
||||
@"Tango",@"Sierra",@"November",@"Zulu",@"Delta",@"Hotel",@"Juliet"]
|
||||
|
||||
CFStringRef needle = @"Sierra"
|
||||
|
||||
NSInteger index = fn ArrayIndexOfObject( haystack, needle )
|
||||
if ( index != NSNotFound )
|
||||
print needle;@" found at index ";index
|
||||
else
|
||||
print needle;@" not found"
|
||||
end if
|
||||
|
||||
ArrayEnumerateObjectsWithOptions( haystack, NSEnumerationReverse, @fn MyEnumeratorCallback, (ptr)@"Tango" )
|
||||
end fn
|
||||
|
||||
fn DoIt
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue