Prev Page Next Page
Format
Previous Top Next

Returns a string representing a given number in a specific format.

Syntax: Format (Number, Format String)

A format consists of a pattern and a set of symbols. Many characters in a pattern are taken literally; they are matched during parsing and are written out unchanged during formatting. On the other hand, special characters stand for other characters, strings, or classes of characters. For example, the '#' character is replaced by a localized digit. Often the replacement character is the same as the pattern character; in the U.S. locale, the ',' grouping character is replaced by ','. Some special characters affect the behavior of the formatter by their presence; for example, if the percent character is seen, then the value is multiplied by 100 before being displayed.

A pattern contains a postive and negative subpattern, for example, "#,##0.00;(#,##0.00)". Each subpattern has a prefix, a numeric part and a suffix. If there is no explicit negative subpattern, the negative subpattern is the localized minus sign prefixed to the positive subpattern. That is, "0.00" alone is equivalent to "0.00;-0.00". If there is an explicit negative subpattern, it serves only to specify the negative prefix and suffix; the number of digits, minimal digits, and other characteristics are ignored in the negative subpattern. This means that "#,##0.0#;(#)" produces precisely the same result as "#,##0.0#;(#,##0.0#)".

0  represents a digit.
#  represents a digit, leading zeroes are not shown.
.   represents the decimal separator or monetary decimal separator.
-  represents the minus sign.
,  represents a grouping separator.
E separates mantissa and exponent in scientific notation.
+  prefix positive exponents with localized plus sign.
;  separates positive and negative subpatterns.
% multiply by 100 and show as percentage.
' used to quote special characters in a prefix or suffix, for example, "'#'#" formats 123 to "#123". To create a single quote itself, use two in a row: "# o''clock".

The formatting rules are those for an Android DecimalFormat object.
http://developer.android.com/reference/java/text/DecimalFormat.html

Example:
Msgbox (Format(1234.5678,",##0.##"))
Will display: 1,234.57
Prev Page Next Page
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)