Predefined Numeric Formats (Format Function)

The following table identifies the predefined numeric format names. These may be used by name as the style argument for the Format function:

Format name

Description

General Number, G, or g

Displays number with no thousand separator.

Currency, C, or c

Displays number with thousand separator, if appropriate; displays two digits to the right of the decimal separator. Output is based on system locale settings.

Fixed, F, or f

Displays at least one digit to the left and two digits to the right of the decimal separator.

Standard, N, or n

Displays number with thousand separator, at least one digit to the left and two digits to the right of the decimal separator.

Percent

Displays number multiplied by 100 with a percent sign (%) appended immediately to the right; always displays two digits to the right of the decimal separator.

P, or p

Displays number with thousandths separator multiplied by 100 with a percent sign (%) appended to the right and separated by a single space; always displays two digits to the right of the decimal separator.

Scientific

Uses standard scientific notation, providing two significant digits.

E, or e

Uses standard scientific notation, providing six significant digits.

D, or d

Displays number as a string that contains the value of the number in Decimal (base 10) format. This option is supported for integral types (Byte, Short, Integer, Long) only.

X, or x

Displays number as a string that contains the value of the number in Hexadecimal (base 16) format. This option is supported for integral types (Byte, Short, Integer, Long) only.

Yes/No

Displays No if number is 0; otherwise, displays Yes.

True/False

Displays False if number is 0; otherwise, displays True.

On/Off

Displays Off if number is 0; otherwise, displays On.

Smart Device Developer Notes

The Yes/No, True/False, and On/Off formats are not supported.

Requirements

Namespace:Microsoft.VisualBasic

**Module:**Strings

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

See Also

Reference

String Manipulation Summary

Conversion Summary

Format Function

Predefined Date/Time Formats (Format Function)

User-Defined Numeric Formats (Format Function)