Numberformat
Mark Smith
lists at futilism.com
Tue Aug 26 15:58:41 EDT 2008
The docs say "It affects numbers only when they are calculated and
then displayed or used as strings."
I found that if you use <put item 1 of someNum + 0 into word 1 of
padedNum>
this forces padedNum to be a string, and you get '08'
I've always found the numberFormat thing confusing, so I always use
'format' in these cases...
Best,
Mark
On 26 Aug 2008, at 20:46, David Bovill wrote:
> I get a "8".
>
> Here I've extracted this function:
>
> function date_PadTwoZeros someNum
>> set the numberformat to "00.######"
>> put item 1 of someNum + 0 into padedNum
>> set the numberformat to "0.######"
>> return padedNum
>> end date_PadTwoZeros
>>
>> put date_PadTwoZeros("8") --> "8"
>>
>> function date_PadTwoZeros someNum
>> if the number of chars of someNum = 1 then
>> return "0" & someNum
>> else
>> return someNum
>> end if
>> end date_PadTwoZeros
>>
>> put date_PadTwoZeros("8") --> "08"
>>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list