the new chaos of Str()-functions is very annoying and not pure. Look at this code:
Code: Select all
test1$ = StrD(2.67896543322678)
test2$ = StrF(345.23)
test3$ = Str(201)
test4$ = StrQ(12147483647)
Debug test1$ ; 2.678965
Debug test2$ ; 345.230011
Debug test3$ ; 201
Debug test4$ ; 12147483647
-----------------------
Look at FreeBasic. Thats pure! And the results are ok:
Code: Select all
test1$ = Str(2.67896543322678)
test2$ = Str(345.23)
test3$ = Str(201)
test4$ = Str(12147483647)
print test1$ ' 2.67896543322678
print test2$ ' 345.23
print test3$ ' 201
print test4$ ' 12147483647
sleep
-----------------------
My wish: a single Str()-Function for all types with optional parameter like this:
Code: Select all
;With second parameter, add or cut decimals:
test1$ = Str(2.67896543322678, 3)
test2$ = Str(345.23, 4)
test3$ = Str(201, 8)
test4$ = Str(12147483647, 2)
Debug test1$ ; 2.678
Debug test2$ ; 345.2300
Debug test3$ ; 201.00000000
Debug test4$ ; 12147483647.00
;Without second parameter, output the number is as is:
test1$ = Str(2.67896543322678)
test2$ = Str(345.23)
test3$ = Str(201)
test4$ = Str(12147483647)
Debug test1$ ; 2.67896543322678
Debug test2$ ; 345.23
Debug test3$ ; 201
Debug test4$ ; 12147483647