I am answering my own question.
The code below does the job:
Uses "Console" PrintL format$(123456789123456.123,"#,###.###") WaitKey
Is there an easier way to separate thousands with comma?
In the code above, we would have to know beforehand how large the value to be printed is, and the code would fail to place all the commas if the value were larger.Uses "Console" PrintL format$(123456789.123,"###,###,###.###") WaitKey
We could use
to anticipate larger values, but I wonder if there is a more elegant solution.PrintL format$(123456789.123,"###,###,###,###,###,###,###,###.###")
Last edited by paravantis; 29-08-2024 at 18:29.
I am answering my own question.
The code below does the job:
Uses "Console" PrintL format$(123456789123456.123,"#,###.###") WaitKey
Thank you for sharing the solution with others!
I suspect even this could work:
We should expand the docs to reduce the guesswork.uses "console" printl format$(1212313212313.123456, "#,.000") waitkey
Petr
Last edited by Petr Schreiber; 01-09-2024 at 17:54.
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Bookmarks