Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
44
Task/Pangram-checker/FutureBasic/pangram-checker.basic
Normal file
44
Task/Pangram-checker/FutureBasic/pangram-checker.basic
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
include "NSLog.incl"
|
||||
|
||||
local fn IsPangram( pangramString as CFStringRef ) as BOOL
|
||||
NSUInteger i, count
|
||||
BOOL result
|
||||
|
||||
CFStringRef lcPanStr = fn StringLowerCaseString( pangramString )
|
||||
CFMutableSetRef mutSet = fn MutableSetWithCapacity( 0 )
|
||||
|
||||
count = len(lcPanStr)
|
||||
for i = 0 to count - 1
|
||||
if ( fn CharacterSetCharacterIsMember( fn CharacterSetLowercaseLetterSet, fn StringCharacterAtIndex( lcPanStr, i ) ) )
|
||||
MutableSetAddObject( mutSet, fn StringWithFormat( @"%c", fn StringCharacterAtIndex( lcPanStr, i ) ) )
|
||||
end if
|
||||
next
|
||||
if fn SetCount( mutSet ) >= 26 then result = YES else result = NO
|
||||
end fn = result
|
||||
|
||||
|
||||
CFStringRef testStr, trueStr, falseStr
|
||||
CFArrayRef array
|
||||
|
||||
trueStr = @"Is a pangram"
|
||||
falseStr = @"Not a pangram"
|
||||
|
||||
array = @[¬
|
||||
@"My dog has fleas.",¬
|
||||
@"The quick brown fox jumps over the lazy do.",¬
|
||||
@"The quick brown fox jumped over the lazy dog.",¬
|
||||
@"The quick brown fox jumps over the lazy dog.",¬
|
||||
@"Jackdaws love my big sphinx of quartz.",¬
|
||||
@"What's a jackdaw?",¬
|
||||
@"Watch \"Jeopardy!\", Alex Trebek's fun TV quiz game.",¬
|
||||
@"Pack my box with five dozen liquor jugs.",¬
|
||||
@"This definitely is not a pangram.",¬
|
||||
@"This is a random long sentence just for testing purposes."]
|
||||
|
||||
for testStr in array
|
||||
if ( fn IsPangram( testStr ) )
|
||||
NSLog( @"%13s : %@", fn StringUTF8String( trueStr ), testStr ) else NSLog( @"%s : %@", fn StringUTF8String( falseStr ), testStr )
|
||||
end if
|
||||
next
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue