IT. Expert System.

VBS

FormatNumber()


Description

The FormatNumber() function returns an expression formatted as a number.

This function has the form:

FormatNumber(expression [,NumDigAfterDec [,IncLeadingDig [,UseParForNegNum [,GroupDig]]]])

Parameter Description
expression (required) The expression to be formatted
NumDigAfterDec (optional) Indicates how many places to the right of the decimal are displayed. Default is -1 (the computer's regional settings are used)
IncLeadingDig (optional) Indicates whether or not a leading zero is displayed for fractional values:
  • -2 = TristateUseDefault - Use the computer's regional settings
  • -1 = TristateTrue - True
  • 0 = TristateFalse - False
UseParFor
NegNum
(optional) Indicates whether or not to place negative values within parentheses:
  • -2 = TristateUseDefault - Use the computer's regional settings
  • -1 = TristateTrue - True
  • 0 = TristateFalse - False
GroupDig (optional) Indicates whether or not numbers are grouped using the group delimiter specified in the computer's regional settings:
  • -2 = TristateUseDefault - Use the computer's regional settings
  • -1 = TristateTrue - True
  • 0 = TristateFalse - False

Examples

The following examples show the basic use of this function:

Example 1

Msgbox(FormatNumber(20000))

This produces the following result:

20,000.00

Example 2

Setting number of decimals:

Msgbox(FormatNumber(20000,2))
Msgbox(FormatNumber(20000,5))

This produces the following result (each line in a separate pop-up message box):

20,000.00
20,000.00000

Example 3

Fractional values with or without a leading zero:

Msgbox(FormatNumber(.20,,0))
Msgbox(FormatNumber(.20,,-1))

This produces the following result (each line in a separate pop-up message box):

.20
0.20

Example 4

Negative values inside parentheses or not:

Msgbox(FormatNumber(-50,,,0))
Msgbox(FormatNumber(-50,,,-1))

This produces the following result (each line in a separate pop-up message box):

-50.00
(50.00)

Example 5

Grouping numbers - or not:

Msgbox(FormatNumber(1000000,,,,0))
Msgbox(FormatNumber(1000000,,,,-1))

This produces the following result (each line in a separate pop-up message box):

1000000.00
1,000,000.00

Miscellaneous Information

Supported in Version: 2.0


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 222 / 158679575. Delta: 0.00363 с