Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What do you like to use for adding commas to numerical output?
#1
I've never used PRINT USING in my programs, so I usually code something like this demo...

Code: (Select All)
DIM a AS _INTEGER64
DO
    INPUT a
    a$ = LTRIM$(STR$(ABS(a)))
    j = LEN(a$) MOD 3: IF j = 0 THEN j = 3
    DO UNTIL j >= LEN(a$)
        a$ = MID$(a$, 1, j) + "," + MID$(a$, j + 1)
        j = j + 4
    LOOP
    IF a < 0 THEN a$ = "-" + a$
    PRINT a$ ' Output with commas.
LOOP

Pete
Reply


Messages In This Thread
What do you like to use for adding commas to numerical output? - by Pete - 05-21-2022, 08:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Linux: terminal output Parkland 4 871 06-08-2025, 04:00 PM
Last Post: DSMan195276
Question numerical prefix for 16 ? madscijr 6 1,672 11-09-2022, 07:03 PM
Last Post: mnrvovrfc
  Commas in string variable? bert22306 4 1,103 09-09-2022, 04:36 AM
Last Post: bert22306
  Adding more Logical Operators Dimster 15 3,294 06-14-2022, 07:58 PM
Last Post: madscijr

Forum Jump:


Users browsing this thread: 1 Guest(s)