include "NSLog.incl" local fn CanBlocksSpell( w as CFStringRef ) as CFStringRef NSUInteger i, j CFStringRef cFinal = @"", result = @"NO" CFMutableArrayRef blocks blocks = fn MutableArrayWithArray( @[@"BO", @"XK", @"DQ", @"CP",¬ @"NA", @"GT", @"RE", @"TG", @"QD", @"FS", @"JW", @"HU", @"VI",¬ @"AN", @"OB", @"ER", @"FS", @"LY", @"PC", @"ZM"] ) CFStringRef cfStr = fn StringUppercaseString( w ) NSUInteger length = fn StringLength( cfStr ) NSUInteger count = fn ArrayCount( blocks ) for i = 0 to length - 1 for j = 0 to count - 1 CFStringRef charStr = mid( cfStr, i, 1 ) CFStringRef compareStr = fn ArrayObjectAtIndex( blocks, j ) CFStringRef testStr1 = mid( compareStr, 0, 1 ) CFStringRef testStr2 = mid( compareStr, 1, 1 ) if ( fn StringIsEqual( charStr, testStr1 ) == YES ) cFinal = fn StringByAppendingString( cFinal, testStr1 ) : MutableArrayReplaceObjectAtIndex( blocks, @" ", j ) : exit for end if if ( fn StringIsEqual( charStr, testStr2 ) == YES ) cFinal = fn StringByAppendingString( cFinal, testStr2 ) : MutableArrayReplaceObjectAtIndex( blocks, @" ", j ) : exit for end if next next if fn StringIsEqual( cFinal, cfStr ) == YES then result = @"YES" end fn = result NSLog( @"a: Can blocks spell? %@", fn CanBlocksSpell( @"a" ) ) NSLog( @"Bark: Can blocks spell? %@", fn CanBlocksSpell( @"Bark" ) ) NSLog( @"BOOK: Can blocks spell? %@", fn CanBlocksSpell( @"BOOK" ) ) NSLog( @"TrEaT: Can blocks spell? %@", fn CanBlocksSpell( @"TrEaT" ) ) NSLog( @"COMMON: Can blocks spell? %@", fn CanBlocksSpell( @"COMMON" ) ) NSLog( @"Squad: Can blocks spell? %@", fn CanBlocksSpell( @"Squad" ) ) NSLog( @"conFUse: Can blocks spell? %@", fn CanBlocksSpell( @"conFUse" ) ) HandleEvents