Understanding numberformat

Klaus major-k klaus at major-k.de
Fri Apr 6 07:17:51 EDT 2018


Hi friends,

maybe I have a little understanding problem with numberformat.
Looks like this is "temporary/fleeting"?

Meanwhile I worked around this with the FORMAT() function, 
but would like to understand the problem.

I have this button script:
###############################################################
## Neccessary function, since in most non-enlsih speaking countries like germany
## we use the COMMA as a decimal delimiter
## Neccessary for calculations
## tZahl = tNumber
## ohne_komma = without comma
function ohne_komma tZahl
  replace "," with "." in tZahl
  return tZahl
end ohne_komma

## mit_komma = with comma
## Neccessary for displaying numbers
function mit_komma tZahl
   replace "." with "," in tZahl
   return tZahl
end mit_komma

on mouseUp pMouseButton
   put 10  into menge ## amount
   put "2,3" into preis ## price
   
   set the numberformat to 0.00
   put ohne_komma(menge) into menge
   put ohne_komma(preis) into preis
   put  menge * preis into ergebnis ## result

##!!!
   answer ergebnis ## -> 23.00
   answer mit_komma(ergebnis) ## -> 23
##!!!

end mouseUp
###############################################################

The last 2 lines of the mouseup handler are puzzling me, what do I not get?
Thanks for any insight!

It would be nice if LC would take these country specific differences into account
in one of the next versions.


Best

Klaus

--
Klaus Major
http://www.major-k.de
klaus at major-k.de





More information about the Use-livecode mailing list