Data update
This commit is contained in:
parent
52a6ef48dd
commit
157b70a810
604 changed files with 14253 additions and 2100 deletions
30
Task/Palindrome-dates/FutureBasic/palindrome-dates.basic
Normal file
30
Task/Palindrome-dates/FutureBasic/palindrome-dates.basic
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue