Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
29
Task/Letter-frequency/FutureBasic/letter-frequency.basic
Normal file
29
Task/Letter-frequency/FutureBasic/letter-frequency.basic
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
include "NSLog.incl"
|
||||
include resources "MyTextFile.txt"
|
||||
|
||||
void local fn DoIt
|
||||
CFURLRef url
|
||||
CFStringRef string
|
||||
NSUInteger length, index
|
||||
unichar chr
|
||||
CountedSetRef set
|
||||
CFNumberRef number
|
||||
|
||||
url = fn BundleURLForResource( fn BundleMain, @"MyTextFile", @"txt", NULL )
|
||||
string = fn StringWithContentsOfURL( url, NSUTF8StringEncoding, NULL )
|
||||
if ( string )
|
||||
set = fn CountedSetWithCapacity(0)
|
||||
length = len(string)
|
||||
for index = 0 to length - 1
|
||||
chr = fn StringCharacterAtIndex( string, index )
|
||||
CountedSetAddObject( set, @(chr) )
|
||||
next
|
||||
for number in set
|
||||
NSLog(@"%C = %ld",intVal(number),fn CountedSetCountForObject( set, number ))
|
||||
next
|
||||
end if
|
||||
end fn
|
||||
|
||||
fn DoIt
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue