31 lines
914 B
Plaintext
31 lines
914 B
Plaintext
BOOL local fn IsPalindrome( string as CFStringRef )
|
|
CFMutableStringRef tempString = fn MutableStringNew
|
|
for long i = len(string) - 1 to 0 step -1
|
|
MutableStringAppendString( tempString, mid(string,i,1) )
|
|
next
|
|
end fn = fn StringIsEqual( string, tempString )
|
|
|
|
void local fn DoIt
|
|
DateFormatterRef format = fn DateFormatterInit
|
|
DateFormatterSetDateFormat( format, @"yyyyMMdd" )
|
|
|
|
DateFormatterRef outputFormat = fn DateFormatterInit
|
|
DateFormatterSetDateFormat( outputFormat, @"yyyy-MM-dd" )
|
|
|
|
long count = 0, limit = 15
|
|
CFCalendarRef calendar = fn CalendarCurrent
|
|
CFDateRef dt = fn DateInit
|
|
|
|
while ( count < limit )
|
|
if ( fn IsPalindrome( fn DateFormatterStringFromDate( format, dt ) ) )
|
|
print fn DateFormatterStringFromDate( outputFormat, dt )
|
|
count ++
|
|
end if
|
|
dt = fn CalendarDateByAddingUnit( calendar, NSCalendarUnitDay, 1, dt, 0 )
|
|
wend
|
|
end fn
|
|
|
|
fn DoIt
|
|
|
|
HandleEvents
|