FORMAT$ returns a string formatted according to instructions contained in a format expression.

Syntax

FORMAT$(ExpressionFormat$)

Arguments

  • Expression is either a numeric or a string expression;
  • Format$ is a string containing the format instructions.
    The following values are possible:
    • Numeric expression:
      • "Ix" -> integer (=I) with x positions:
        FORMAT$(Pi,"I3") returns "  3"
      • "Ex.y" -> exponential format (=E), x positions for total number, y decimal positions:
        FORMAT$(Pi,"E12.3") returns "   0.314E+01"
      • "Fx.y" -> fixed format (=F), x positions for total number, y decimal positions:
        FORMAT$(Pi,"F12.3") returns "       3.142"
    • String expression:
      • Ax -> ASCII text (=A) with x positions:
        FORMAT$("Qnowledge Wageningen","A25") returns "Qnowledge Wageningen     "
    • Special actions:
      • "Xs|Format$" adds s amount of leading spaces to the returned value
      • "Format$|Xs" adds s amount of trailing spaces to the returned value
        FORMAT$("Qnowledge", "X2|A9|X3") 
        returns
        "  Qnowledge   "
      • "Format$/|" adds a [CRLF] to the returned value
        FORMAT$("Qnowledge", "X2|A9|X3/|") + FORMAT$("BV", "A2")  
        returns

        "  Qnowledge   
        BV"

Remarks

  1. The full value for all formats is returned, also if the indicated cell length is too small to contain the value. E.g.
    FORMAT$("Qnowledge Wageningen","A6") returns "Qnowledge Wageningen"
  2. Furthermore, note that by default numbers are aligned to the right and strings are aligned to the left.

 

 

Quick links: Functions overview | Attribute overview | Constants overview | Dimensions overview


  • No labels