Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,33 @@
|
|||
local fn MiddleThreeDigits( n as NSInteger ) as CFStringRef
|
||||
CFStringRef testStr, resultStr
|
||||
NSInteger length, middle
|
||||
|
||||
testStr = fn StringWithFormat( @"%ld", n )
|
||||
testStr = fn StringByReplacingOccurrencesOfString( testStr, @"-", @"" )
|
||||
length = len(testStr)
|
||||
if length < 3 then resultStr = fn StringWithFormat( @"%10ld -> Error: Less than three digits.", n ) : exit fn
|
||||
if length == 3 then resultStr = fn StringWithFormat( @"%10ld -> %@", n, testStr ) : exit fn
|
||||
length = len(testStr)
|
||||
if ( length mod 2 == 0 )
|
||||
resultStr = fn StringWithFormat( @"%10ld -> Error: Even length; needs odd.", n )
|
||||
else
|
||||
middle = length / 2
|
||||
resultStr = fn StringWithFormat( @"%10ld -> %@", n, mid( testStr, middle -1, 3 ) )
|
||||
end if
|
||||
end fn = resultStr
|
||||
|
||||
window 1, @"Middle Three Digits", ( 0, 0, 400, 300 )
|
||||
|
||||
NSUInteger i, count
|
||||
CFArrayRef testArr
|
||||
CFNumberRef tempNum
|
||||
|
||||
testArr = @[@123,@12345,@1234567,@987654321,@10001,@-10001,¬
|
||||
@-123,@-100,@100,@-12345,@1,@2,@-1,@-10,@2002,@-2002,@0]
|
||||
|
||||
count = fn ArrayCount( testArr )
|
||||
for i = 0 to count - 1
|
||||
print fn MiddleThreeDigits( fn NumberIntegerValue( testArr[i] ) )
|
||||
next
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue