Vanguard Software
Forecasting & Planning Solutions

contents.gifindex.gifprev1.gifnext1.gif

tostring

Format: tostring( list, format, sep, wid )

Arguments: [any] list Input list

(real) format Optional format specifier; default = 0

(text) sep Optional separator between list elements; default = ","

(int) wid Optional maximum string width before line break; default = none

Returns: (text) Text string containing all elements in list separated by sep

Description: Tostring converts a list of objects to a single text string. If any of the objects in list are numbers, they are converted to strings as they would be displayed. If wid is supplied, a line break is inserted before every object that would cause a line to extend beyond the wid column.

You can control how numbers are converted to text by specifying the format argument, which is created by adding the following constants.

Decimals/Significant Digits (choose one only):

FMT_D0 0 digits

FMT_D1 1 digits

FMT_D2 2 digits

FMT_D3 3 digits

FMT_D4 4 digits

FMT_D5 5 digits

FMT_D6 6 digits

FMT_D7 7 digits

FMT_D8 8 digits

FMT_D9 9 digits

Format (choose one only):

FMT_FIX Fixed decimal

FMT_SIG Significant digits only

FMT_SCI Scientific notation

FMT_ENG Engineering notation

Style (may combine more than one):

FMT_ZER Suppress trailing zeros

FMT_PCT Percent

FMT_SEP 000's separator

FMT_DLR Currency symbol

FMT_PRN Parentheses on negative numbers

FMT_UNT Reduce compound units

Examples: tostring(PI,FMT_D3+FMT_FIX) = 3.142

tostring(0.234,FMT_D0+FMT_FIX+FMT_PCT) = 23%

tostring([1,2,3,4,5],0,";",4) = 1;2;
3;4;
5

See Also: tolist, tonumber

  Forecasting Software  |  Strategic Planning Software  |  Decision Support Software
Decision Tree Analysis  |  Monte Carlo Simulation Software  |  Risk Analysis Software
Portfolio Analysis  |  Expert System Software  |  Market Research Surveys

Contact Us  |  Terms of Use  |  Privacy Policy  |  Site Map
Vanguard Software
© 2009 Vanguard Software Corporation
Home Products Solutions Services Customers Partners Company
Vanguard
Applying science to business management
Vanguard
Print this page   Email this page to a friend