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



Users browsing this thread: 4 Guest(s)