Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,60 @@
|
|||
include "NSLog.incl"
|
||||
include resources "DaysOfWeek.txt"
|
||||
|
||||
local fn DaysOfWeek as CFArrayRef
|
||||
CFURLRef url
|
||||
CFStringRef string
|
||||
CFArrayRef weeks = NULL
|
||||
|
||||
url = fn BundleURLForResource( fn BundleMain, @"DaysOfWeek", @"txt", NULL )
|
||||
string = fn StringWithContentsOfURL( url, NSUTF8StringEncoding, NULL )
|
||||
if ( string )
|
||||
weeks = fn StringComponentsSeparatedByCharactersInSet( string, fn CharacterSetNewlineSet )
|
||||
end if
|
||||
end fn = weeks
|
||||
|
||||
local fn MinAbbreviationLength( week as CFStringRef ) as long
|
||||
CFArrayRef days
|
||||
CFStringRef day1, day2, abbr
|
||||
long count, length, minLen, index1, index2
|
||||
|
||||
minLen = 1
|
||||
days = fn StringComponentsSeparatedByString( week, @" " )
|
||||
if ( len( days ) == 7 )
|
||||
count = len( days )
|
||||
for index1 = 0 to count - 1
|
||||
day1 = days[index1]
|
||||
length = len( day1 )
|
||||
abbr = left( day1, minLen )
|
||||
for index2 = 0 to count - 1
|
||||
if ( index2 == index1 ) then continue
|
||||
day2 = days[index2]
|
||||
while ( fn StringHasPrefix( day2, abbr ) )
|
||||
minLen++
|
||||
if ( minLen > length ) then break
|
||||
abbr = left( day1, minLen )
|
||||
wend
|
||||
next
|
||||
next
|
||||
end if
|
||||
end fn = minLen
|
||||
|
||||
void local fn Abbreviations
|
||||
CFArrayRef weeks
|
||||
CFStringRef week
|
||||
|
||||
weeks = fn DaysOfWeek
|
||||
if ( weeks )
|
||||
for week in weeks
|
||||
if ( len(week) )
|
||||
NSLog(@"%ld\t%@",fn MinAbbreviationLength( week ),week)
|
||||
else
|
||||
NSLog(@"NULL")
|
||||
end if
|
||||
next
|
||||
end if
|
||||
end fn
|
||||
|
||||
fn Abbreviations
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue