TOPIC: Leading zero in decimal numbers
#1242
Leading zero in decimal numbers 1 Year, 11 Months ago
Hi, why does Suneido discard leading zero before a decimal number that begins with "0." ? From the language settings in my Vista OS, such numbers should be displayed with the "0" before the separation point. There is a way to display (and to print) all these numbers with a leading zero?
 
 
Mauro
 
#1243
Re:Leading zero in decimal numbers 1 Year, 10 Months ago
Suneido's suppression of the leading zeroes would appear to be independent of the language settings of Vista or XP, it's done automatically for numbers.

Something to consider might be extending the mask in NumberControl and/or NumberFormat to handle mandatory place holders, then the leading zeroes could be displayed.

I also played around with this bit of code on my Workspace:

num = 0.123
num = String(num)
Print(Number(num).Pad(num.Size() + (num.BeforeFirst('.') is '' ? 1 : 0)))


This displays a number with a leading zero when the zero is the only thing left of the decimal, otherwise numbers are displayed normally.

Hope this is helpful.
 
 
Last Edit: 2008/10/01 00:19 By jpe.
 
Jason Elias
Suneido Software
 
#1244
Re:Leading zero in decimal numbers 1 Year, 10 Months ago
Thank you for your suggestion. It was very helpful. However I think that the best thing would be for Suneido to adapt its number displaying to the OS language settings. In this way, we shouldn't modify the code if we change the country settings...
 
 
Last Edit: 2008/10/02 11:44 By Mauro.
 
Mauro
 
#1245
Re:Leading zero in decimal numbers 1 Year, 10 Months ago
Hi Mauro,

I agree it would be good to use the OS formatting settings for numbers like we do for dates.

This would require making Suneido's number formatting "compatible" with Window's. I have not looked at what this requires. It probably would not be too hard. We would have to be careful not to "break" existing code.

I wonder what happens if Suneido runs on Linux where I assume there would be a different system for formatting. Is it similar enough to Windows for Suneido to handle both?
 
 
andrew