Abbreviations, automatic: Difference between revisions
Content deleted Content added
No edit summary |
No edit summary |
||
Line 3,164: | Line 3,164: | ||
</pre> |
</pre> |
||
=={{header| |
=={{header|FutureBasic}}== |
||
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" |
||
local fn DaysOfWeek as CFArrayRef |
local fn DaysOfWeek as CFArrayRef |
||
⚫ | |||
'~'1 |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
end fn = weeks |
end fn = weeks |
||
local fn MinLengthAbbreviation( week as CFStringRef ) as long |
local fn MinLengthAbbreviation( week as CFStringRef ) as long |
||
⚫ | |||
'~'1 |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
count = len( days ) |
|||
⚫ | |||
count = len( days ) |
|||
⚫ | |||
⚫ | |||
length = len( day1 ) |
|||
⚫ | |||
abbr = left( day1, minLen ) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
minLen++ |
|||
⚫ | |||
⚫ | |||
minLen++ |
|||
⚫ | |||
⚫ | |||
else |
|||
abbr = left( day1, minLen ) |
|||
break |
|||
else |
|||
end if |
|||
break |
|||
wend |
|||
⚫ | |||
end if |
|||
wend |
|||
next |
|||
⚫ | |||
next |
next |
||
⚫ | |||
⚫ | |||
⚫ | |||
end fn = minLen |
end fn = minLen |
||
void local fn Abbreviations |
void local fn Abbreviations |
||
⚫ | |||
'~'1 |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
if ( len(week) ) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
else |
|||
⚫ | |||
⚫ | |||
else |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
next |
|||
end if |
|||
end fn |
end fn |
||