Jump to content

Letter frequency: Difference between revisions

no edit summary
m (syntax highlighting fixup automation)
No edit summary
Line 2,940:
ñ 2
</pre>
 
=={{header|FutureBasic}}==
Assumes a text file named "MyTextFile.txt" is in the same folder as the FB code file.
<syntaxhighlight lang="futurebasic">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</syntaxhighlight>
 
 
=={{header|Gambas}}==
416

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.