Format style table
The following table shows the format style options, and demonstrates how these options would
change the appearance of a sample input number, 1235.00
.
Format Style  Values  Description  Examples  

Mask  Output  
Fill  All characters  Accepts all characters except curly brackets: { and
} 

Align  <  Forces leftalignment within the specified space.  *<6 
1235** 
>  Forces rightalignment within the specified space (default).  *>6 
**1235 

^  Forces central alignment within the specified space.  *^6 
*1235* 

Sign  Plus +  Uses a sign for both positive and negative numbers.  + 
+1235 
Minus   Uses a sign for only negative numbers (default).   
1235 

Space  Uses a leading space on positive numbers, and a minus sign on negative numbers.  ' ' 
1235 

Symbol  $  Prefixes the $ (Dollar) currency symbol.  $ 
$1235 
£  Prefixes the £ (Pounds Sterling) currency symbol.  £ 
£1235 

¥  Prefixes the ¥ (Japanese Yen) currency symbol.  ¥ 
¥1235 

₹  Prefixes the ₹ (Indian Rupee) currency symbol.  ₹ 
₹1235 

€  Prefixes the € (Euro) currency symbol.  € 
€1235 

0  0  Enables zeropadding.  06 
001235 
Width  width  Defines the minimum field width. If not specified, the width is determined by the content.  6

1235 
,  ,  Enables the use of a comma to separate every third digit.  , 
1,235 
Precision  .precision  Indicates how many digits must be displayed after the decimal point, for a value formatted with types e, f and %, or before and after the decimal point for values formatted with types g, r, and p.  See f, g, r, p, and % types for examples  
Types  b  Binary: Outputs the number in base 2.  b 
10011010011 
c  Character: Converts the integer to the corresponding Unicode character.  c 
ä 

d  Integer: Outputs the number in base 10. Ignores noninteger values.  d 
1235 

e  Exponent notation: Displays the number in scientific
notation, using the letter e to indicate the exponent. 
e 
1.235e+3 

.1e 
1.2e+3 

f  Fixed point: Displays the number as a fixedpoint number.  f 
1235 

.1f 
1235.0 

g  General: For a given
precision p >= 1 , this rounds the number
to p significant digits and then formats the result in either
fixedpoint format or in scientific notation, depending on its magnitude. 
g 
1235 

.2g 
1.2e+3 

.5g 
1235.0 

n  Formatted Number: This is the same as d, except that it uses the current locale setting to insert the appropriate number separator characters.  n 
1,235 

.2n 
1.2e+3 

.5n 
1,235.0 

o  Octal: Outputs the number in base 8.  o 
2323 

r  Rounded: Similar to general format, but does not use scientific notation.  r 
1235 

.2r 
1200 

.5r 
1235.0 

s 
String: Rounded and using scientific notation, but with a unit suffixed. See, Name and Symbol in Quantity prefixes.

s 
1.235k 

.2s 
1.2k 

.5s 
1.2350k 

S 
String: Rounded and using regular currency unit suffixes. See, Quantity prefixes.

$S 
$1235 

$S, 
$1,235 

x 
Hex: Outputs the number in base 16, using the lowercase letters for the digits greater than 9.

x 
4d3 

X 
Hex: Outputs the number in base 16, using the lower case letters for the digits greater than 9.

X 
4D3 

%  Percentage: Multiplies the number by 100 and
displays it in fixed f format, followed by a percent sign. 
% 
123500% 

.1% 
123500.0% 