var2string function

Converts Numeric Variables into Padded Strings

Converts Numeric Variables into Padded Strings

Mechanism for converting numeric variables into strings for reporting.

var2string(vars, maxlength = 0, nsig_e = 3, nsig_f = 4)

Arguments

  • vars: numeric variable or a vector of numeric variables
  • maxlength: if this value is greater than zero spaces will be added to the beginning of the string until the total length is equal to maxlength
  • nsig_e: number of significant figures for scientific notation
  • nsig_f: number of significant figures for numbers (2.123)

Returns

Number as a string padded

Examples

var2string(pi, nsig_f=20) var2string(.0001121, nsig_e=2, maxlength=10)
  • Maintainer: John Harrold
  • License: BSD_2_clause + file LICENSE
  • Last published: 2025-01-07