USING$ function

Purpose: USING$ returns a string converted from a number using the format specified in FormatStr$.


 Syntax:

 RetStr$ = USING$(FormatStr$, Number)

 Parameters:

  • RetStr$ Returned string containing formatted Number.
  • FormatStr$ String containing formatting template.
  • Number Number to be formatted and converted to a string.

Example:


 '*************************************************
 '    USING$ demonstration by Kevin Diggins
 '*************************************************
 ' This pretty much shows what you can expect
 ' from my implementation of the USING$ function.
 '     USING$ may be expanded in the future.
 '*************************************************

 DIM A$

 A$ = USING$("###.#",-1.123456789)                  : PRINT A$
 A$ = USING$("###.##",1.123456789)                  : PRINT A$
 A$ = USING$("###.###",1.123456789)                 : PRINT A$
 A$ = USING$("###.####",1.123456789)                : PRINT A$
 A$ = USING$("###.######",1.123456789)              : PRINT A$
 A$ = USING$("###.#######",1.123456789)             : PRINT A$
 A$ = USING$("###.########",1.123456789)            : PRINT A$
 A$ = USING$("###.#########",1.123456789)           : PRINT A$
 A$ = USING$("###.##########",1.123456789)          : PRINT A$
 A$ = USING$(" ###.#",1.123456789)                  : PRINT A$
 A$ = USING$("  ###.##",1.123456789)                : PRINT A$
 A$ = USING$("   ###.###",1.123456789)              : PRINT A$
 A$ = USING$("    ###.####",1.123456789)            : PRINT A$
 A$ = USING$("     ###.######",1.123456789)         : PRINT A$
 A$ = USING$("      ###.#######",1.123456789)       : PRINT A$
 A$ = USING$("       ###.########",1.123456789)     : PRINT A$
 A$ = USING$("        ###.#########",1.123456789)   : PRINT A$
 A$ = USING$("         ###.#########",1.123456789)  : PRINT A$

Result:


 -1.1
  1.12
  1.123
  1.1235
  1.123457
  1.1234568
  1.12345679
  1.123456789
  1.1234567890
   1.1
    1.12
     1.123
      1.1235
       1.123457
        1.1234568
         1.12345679
          1.123456789
           1.123456789

BCX Console Sample Programs using USING$ function.

S136.bas