30 lines
734 B
Plaintext
30 lines
734 B
Plaintext
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
|