Abbreviations, automatic: Difference between revisions

Content added Content deleted
No edit summary
Line 3,167: Line 3,167:
This assumes a text file named "DaysOfWeek.txt" is in the same folder as the code file.
This assumes a text file named "DaysOfWeek.txt" is in the same folder as the code file.


<syntaxhighlight lang="futurebasic">
<syntaxhighlight lang="futurebasic">include "NSLog.incl"
include "NSLog.incl"
include resources "DaysOfWeek.txt"
include resources "DaysOfWeek.txt"


Line 3,183: Line 3,182:
end fn = weeks
end fn = weeks


local fn MinLengthAbbreviation( week as CFStringRef ) as long
local fn MinAbbreviationLength( week as CFStringRef ) as long
CFArrayRef days
CFArrayRef days
CFStringRef day1, day2, abbr
CFStringRef day1, day2, abbr
Line 3,221: Line 3,220:
for week in weeks
for week in weeks
if ( len(week) )
if ( len(week) )
NSLog(@"%ld\t%@",fn MinLengthAbbreviation( week ),week)
NSLog(@"%ld\t%@",fn MinAbbreviationLength( week ),week)
else
else
NSLog(@"NULL")
NSLog(@"NULL")
Line 3,231: Line 3,230:
fn Abbreviations
fn Abbreviations


HandleEvents
HandleEvents</syntaxhighlight>
</syntaxhighlight>


{{out}}
{{out}}
<pre style="height:20ex;">
<pre style="height:15ex;">
2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
Line 3,336: Line 3,334:
2 Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau
2 Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau
</pre>
</pre>



=={{header|Go}}==
=={{header|Go}}==