KiXtart Language Reference (FormatNumber)
[ KiXtart VBScript Batch AutoIt HTA PowerShell Windows Command Lines Other Command Line Utilities ]FormatNumber (Function)
Available from version 4.1 through the latest release.
Syntax
FormatNumber (<Expression> [, <DecimalPlaces>] [, <LeadingDigit>] [, <Parentheses>] [, <Group>])
Parameters
Expression = the value or mathematical calculation to be formatted
DecimalPlaces = optional value that indicates how many places to the right of the decimal should be displayed. The default DecimalPlaces value is –1, which indicates the computer’s regional settings should be used to determine the number of decimal places to be displayed.
LeadingDigit = used to indicate whether or not a leading zero should be displayed for fractional values. A -1 is used to specify the leading zero should be displayed; a 0 is used to specify the leading zero should not be displayed. The default value is –2, indicating that the computer’s regional settings should be used to determine if a leading zero should be displayed for fractional values.
Parentheses = dictates if negative values should be placed within parentheses. A -1 is used to specify the parentheses should be used for negative numbers; a 0 is used to specify parentheses should not be used. The default value is -2, which indicates that the computer’s regional settings should be used to determine if parentheses should be used to surround negative values.
Group = used to specify if numbers should be grouped using the group delimiter specified in the Windows control panel. This is typically a comma (example: 1,000,000). Grouping is forced On by setting this parameter to -1. To specify that no grouping of numbers should be used, the parameter should be set to 0. Once again, by default the value will be -2, indicating that the computer’s regional settings should be used to determine if grouping of numbers should be displayed
Description
Returns an expression formatted as a number
Example
$Value = 1000000
? FormatNumber ($Value,0,,,-1)
; No decimal places with system defined grouping = 1,000,000
$Value = -0.5
? FormatNumber ($Value,-1,-1,0,0)
; Show decimal places and leading digit = -0.50
$Value = -900
? FormatNumber ($Value,0,0,-1)
; Display negative numbers in parenthesis = (900)
$Value = 10
? FormatNumber ($Value,1,0,0,0)
; Display numbers with one decimal place = 10.0
Also see:
Abs CDbl Cint Val CStr Round Int FixRnd SRnd DecToHex ASC
Have a correction, addition or suggestion on this? Please let us know!
Last Edited: 6/1/2004. This page has been viewed 3896 times. Unless otherwise specified, all information is (C) 2004-2007 iTripoli, Inc. All Rights Reserved.
Note: you can view this information right within ASE by right clicking any keyword and selecting "Help..."

Now In Print! 496 Pages of detail covering each and every command. Includes common problems, command alternatives and real-world examples throughout.
Click here for special 35% discount!

iTripoli prides itself on providing top notch customer service
Find answers or open a ticket to ask directly, when opening a ticket we will suggest relavant articles to help you get answers as quickly and accurately as possible. Visit our support center now!



