Format Specifiers

The Format String Editor makes use of a few special characters known as Format Specifiers. These characters allow you to specify how you want the content of the control to be formatted. Below is a list of each of the categories that appears in the editor.

The DateTime category is excluded from this documentation as the Preview in the Format String Editor sufficiently demonstrates the outcome of applying each of the Format Specifiers.

For more information on Format Specifiers see Using Standard Numeric Format Strings, and Using Custom Numeric Format Strings.

Number

Format Specifier

Description

Example

#.00

Specifies that the number has two digits after the decimal.

12345.67 becomes 12345.67

#,#

Specifies that a comma should be used as the thousands separator.

12345.67 becomes 12,345.67

0.E+0.0

Converts a number into a string in a custom scientific notation. Specifies the following conversion elements:

  • The significand must be a whole value with no digits following the decimal.
  • The decimal should be followed by a uppercase E.
  • The order of magnitude must display with no padding.
  • The decimal portion of the significand at the end of the string.

12345.67 becomes 1.E+42

0.e+0.0

Converts a number into a string in a custom scientific notation. Specifies the following conversion elements:

  • The significand must be a whole value with no digits following the decimal.
  • The decimal should be followed by a lowercase e
  • The order of magnitude must display with no padding
  • The decimal portion of the significand at the end of the string.

12345.67 becomes 1.e+42

n

Converts a number to a string. Commas are used as the thousands separator.

12345.67 becomes 12,345.67

n0

Converts a number to a string with no digits after the decimal place. Commas are used as the thousands separator.

12345.67 becomes 12,346

n1

Converts a number to a string with one digit after the decimal place. Commas are used as the thousands separator.

12345.67 becomes 12,345.7

n2

Converts a number to a string with two digits after the decimal place. Commas are usedas the thousands separator.

12345.67 becomes 12,345.67

e

Converts a number into a string in scientific notation.

12345.67 becomes 1.234567e+004

e1

Converts a number into a string in scientific notation. Specifies one digit after the decimal place.

12345.67 becomes 1.2e+004

f

Converts a number into a string with no commas as the thousands separator.

12345.67 becomes 12345.67

f1

Converts a number into a string with no commas as the thousands separator. Specifies one digit after the decimal place.

12345.67 becomes 12345.7

Percent

Format Specifier

Description

Example

0.00%

Multiplies a number by 100 and converts it to a string. Specifies two digits after the decimal place.

12.34 becomes 1234.00%

0%

Multiplies a number by 100 and converts it to a string. Specifies no decimal places.

12.34 becomes 1234%

Currency

Format Specifier

Description

Example

$0.00

Converts a number into a string using the dollar sign as a currency indicator. Specifies two digits after the decimal place.

12.34 becomes $12.34

$0

Converts a number into a string using the dollar sign as a currency indicator. Specifies no digits after the decimal place.

12.34 becomes $12

c

Converts a number into a string that represents a currency amount. Defaults to two decimal places. The currency value displayed corresponds with the culture of the client application.

12.34 becomes $12.34

c1

Converts a number into a string that represents a currency amount. Specifies one digit after the decimal place. The currency value displayed corresponds with the culture of the client application.

12.34 becomes $12.3

c2

Converts a number into a string that represents a currency amount. Specifies two digits after the decimal place. The currency value displayed corresponds with the culture of the client application.

12.34 becomes $12.34

Special

Format Specifier

Description

Example

(###)###-####

Formats a number into a phone number appearance.

1234567890 becomes (123)456-7890

###-##-####

Formats a number into a custom configuration.

123456789 becomes 123-45-6789