date_Construct8601 (was numberformat)

BNig niggemann at uni-wh.de
Wed Aug 27 18:40:11 EDT 2008


Bill,

you could get there with this button script:
-------------------
on mouseUp
   put 1000.13 into tNumber
   if tNumber is not a number then 
    answer "this is not a number"
      exit mouseUp
   end if
   put offset (".", tNumber) into tDecimal
   if tDecimal > 0 then 
      put char 1 to tDecimal-1 of tNumber into tWhole
      put char tDecimal+1 to -1 of tNumber into tFraction
   else 
      put tNumber into tWhole
      put "00" into tFraction
   end if
   put the length of tWhole into tSolong
   put tSolong -2 into tStart
   repeat with i = tStart down to 4  step -3
      put "," before char i of tWhole
   end repeat
   put tWhole & "." & tFraction into field "f1"
end mouseUp
----------------

you would obviously need a field named "f1" for the script to work.
And you can not compute the formatted number without removing the commas.

this is not as smart as Sarah's script but it does the trick. 

regards

Bernd




BILL HUMPHREY wrote:
> 
> Can the format command be used to solve the common task of needing a
> number
> 000,000,000  (put the commas in)?
> 
> Or the format number like accountants
> 
> $          000,000,000.00   ?
> 
> I noticed it has the option for #.00 to set two decimal places but no add
> the commas or put a dollar sign.  I remember that in hypercard we had an
> external for this.
> 
> Thanks,
> 
> Bill
> 

-- 
View this message in context: http://www.nabble.com/date_Construct8601-%28was-numberformat%29-tp19169935p19191191.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list