' Fellippe's link to wiki for PRINT USING table http://www.qb64.org/wiki/PRINT_USING
' Steve McNeill formats$ https://www.qb64.org/forum/index.php?topic=890.msg100887#msg100887
PRINT Format1$
("###.###", "123.456789", 1) PRINT Format1$
("###,.##", "123456789.987654321", 1)
format$ = t$
' RhoSigma's format$ https://www.qb64.org/forum/index.php?topic=890.msg100880#msg100880
'---------------------------------------------------------------------
'Function: Can return a PRINT USING formatted string for assignment to
' any string variable. This is a multiple name function for
' use of upto three arguments (Format$, Format2$, Format3$).
'
'Synopsis: res$ = Format$ (fmt$, arg$, typ%)
' res$ = Format2$ (fmt$, arg$, typ%, arg2$, typ2%)
' res$ = Format3$ (fmt$, arg$, typ%, arg2$, typ2% arg3$, typ3%)
'
'Result: res$ --> the resulting formatted string
'
'Inputs: fmt$ --> the string with format options for PRINT USING
' arg$ --> the argument(s) to format into the fmt$ string,
' use STR$(num) to pass in a number
' typ% --> the type(s) of the respective argument(s),
' 0 = argument is a real (alphanumeric) string
' 1 = argument is a STR$() number string
'
'Notes: This function is adapted and slightly altered from an idea
' posted in the QB64 Forum by Fellippe Heitor,
' see http://www.[abandoned, outdated and now likely malicious qb64 dot net website - don’t go there]/forum/index.php?topic=14219.0
'---------------------------------------------------------------------
shan&
= _SOURCE: dhan&
= _DEST: than&
= _NEWIMAGE(256, 1, 0) 'if results may get longer, then raise the 256 value Format1$ = res$
'-----
FUNCTION Format2$
(fmt$
, arg$
, typ%
, arg2$
, typ2%
) shan&
= _SOURCE: dhan&
= _DEST: than&
= _NEWIMAGE(256, 1, 0) 'if results may get longer, then raise the 256 value Format2$ = res$
'-----
FUNCTION Format3$
(fmt$
, arg$
, typ%
, arg2$
, typ2%
, arg3$
, typ3%
) shan&
= _SOURCE: dhan&
= _DEST: than&
= _NEWIMAGE(256, 1, 0) 'if results may get longer, then raise the 256 value Format3$ = res$