 |
THE HYPERCARD CENTER |
|
|
Note: This is a work in progress and many formatting issues have been fixed. Read more about the project on the home page.
numberFormatset [the] numberFormat to text
where text is a valid number format. The numberFormat property returns or sets the precision with which the results of mathematical operations are displayed in fields and the Message box. The following symbols specify the number format: "0" Use one zero for each digit you want to appear. "." Use a period to indicate the position of the decimal point, if any. "#" Use to indicate where you want trailing digits to appear if they have a value other than zero. HyperCard sets the default number format to "0.######" on idle. Important: numberFormat takes effect only when you perform a mathematical operation on a number. Examples--For the number 2.2: set the numberFormat to "00.00" -- displays 02.20 set the numberFormat to "0" -- displays 2 set the numberFormat to "0.######" -- displays 2.2 In the following set of statements, the Message box would display 3.14159265358979323846 because HyperCard converts the string to a number only when you perform a mathematical operation on it: put pi into myVar set numberFormat to "0.00" put myVar into message box In the next set of statements, the Message box would display 3.14 because HyperCard converts the string to a number when you add 0 to it: put pi into myVar add 0 to myVar set numberFormat to "0.00" put myVar into message box
Related Topics Placeholders
textAn expression that evaluates to a text string. A text expression can be a literal string surrounded by quotation marks or the value of a container. For example: "Hello" "The sum is:" && 3 card field 1 line 1 of bg fld "Address" the Message box the selection myVar -- a variable
See also: background, bkgnd, button, card, field, menu, menuItem, and stack
HyperTalk Reference
|