My code for the 'Sample numeric formats' part seems to give slightly different results however:
Code: Select all
#include "string.bi"
dim as double numberVal(...) = {5, -5, .5}
dim as string formatStr(...) = {"","0","0.00","#,##0","#,##0.00","0%", "0.00%", "0.00E+00", "0.00E-00"}
? "Format (fmt)", str(numberVal(0)), str(numberVal(1)), str(numberVal(2))
for iFormat as integer = 0 to ubound(formatStr)
? formatStr(iFormat),
for iNumber as integer = 0 to ubound(numberVal)
? format(numberVal(iNumber), formatStr(iFormat)),
next
?
next
Code: Select all
Format (fmt) 5 -5 0.5
5 -5 .5
0 5 -5 0
0.00 5.00 -5.00 0.50
#,##0 5 -5 0
#,##0.00 5.00 -5.00 0.50
0% 500% -500% 50%
0.00% 500.00% -500.00% 50.00%
0.00E+00 5.00E+00 -5.00E+00 5.00E-01
0.00E-00 5.00E00 -5.00E00 5.00E-01
Code: Select all
Format (fmt) 5 -5 .5
Null String 5 -5 0.5
0 5 -5 1 <-- different
0.00 5.00 -5.00 0.50
#,##0 5 -5 1 <-- different
#,##0.00 5.00 -5.00 0.50
0% 500% -500% 50%
0.00% 500.00% -500.00% 50.00%
0.00E+00 5.00E+00 -5.00E+00 5.00E-01
0.00E-00 5.00E00 -5.00E00 5.00E-01