Sample format strings for numeric expressions

The following table shows sample format strings for numeric expressions. The character b represents a blank or space.
Table 1. Sample format patterns and their results
Formatting mask Numeric value Formatted result

"#####"
"&&&&&"
"$$$$$"
"*****"
"<<<<<"

0
0
0
0
0

bbbbb 00000 bbbb$ ***** (null string)

“##,###”
"##,###"
"##,###"
"##,###"
"##,###"
"##,###"
"##,###"

12345
1234
123
12
1
-1
0

12,345 b1,234 bbb123 bbbb12 bbbbb1 bbbbb1 bbbbbb

"&&,&&&"
"&&,&&&"
"&&,&&&"
"&&,&&&"
"&&,&&&"
"&&,&&&"
"&&,&&&"

12345
1234
123
12
1
-1
0

12,345
01,234
000123
000012
000001
000001
000000

"$$,$$$"
"$$,$$$"
"$$,$$$"
"$$,$$$"
"$$,$$$"
"$$,$$$"
"$$,$$$"
"$$,$$$"
(DBMONEY set to DM)

12345
1234
123
12
1
-1
0
1234

***** (overflow)

$1,234 bb$123 bbb$12 bbbb$1 bbbb$1 bbbbb$ DM1,234

"**,***"
"**,***"
"**,***"
"**,***"
"**,***"
"**,***"

12345
1234
123
12
1
0

12,345
*1,234
***123
****12
*****1
******

"##,###.##"
"##,###.##"
"##,###.##"
"##,###.##"
"##,###.##"
"##,###.##"
"##,###.##"
"##,###.##"
"##,###.##"

12345.67
1234.56
123.45
12.34
1.23
0.12
0.01
-0.01
-1

12,345.67
b1,234.56
bbb123.45
bbbb12.34
bbbbb1.23
bbbbbb.12
bbbbbb.01
bbbbbb.01
bbbbb1.00

"&&,&&&.&&"
"&&,&&&.&&"
"&&,&&&.&&"
"&&,&&&.&&"

.67
1234.56
123.45
0.01

000000.67
01,234.56
000123.45
000000.01

"$$,$$$.$$"
"$$,$$$.$$"
"$$,$$$.##"
"$$,$$$.##"
"$$,$$$.&&"
"$$,$$$.&&"

12345.67
1234.56
0.00
1234.00
0.00
1234.00

********* (overflow)

$1,234.56 bbbbb$.00 $1,234.00 bbbbb$.00 $1,234.00

"-##,###.##"
"-##,###.##"
"-##,###.##"
"--#,###.##"
"---,###.##"
"---,-##.##"
"---,--#.##"
"--#,###.##"
"---,--#.##"

-12345.67
-123.45
-12.34
-12.34
-12.34
-12.34
-12.34
-1.00
-1.00

-12,345.67
-bbb123.45
-bbbb12.34
b-bbb12.34
bb-bb12.34
bbbb-12.34
bbbb-12.34
b-bbbb1.00
bbbbb-1.00

"-##,###.##"
"-##,###.##"
"-##,###.##"
"-##,###.##"
"--#,###.##"
"---,###.##"
"---,-##.##"
"---,---.##"
"---,---.--"
"---,---.&&"

12345.67
1234.56
123.45
12.34
12.34
12.34
12.34
1.00
-.01
-.01

b12,345.67
bb1,234.56
bbbb123.45
bbbbb12.34
bbbbb12.34
bbbbb12.34
bbbbb12.34
bbbbbb1.00
bbbbbb-.01
bbbbbb-.01

"-$$$,$$$.&&"
"-$$$,$$$.&&"
"-$$$,$$$.&&"
"--$$,$$$.&&"
"--$$,$$$.&&"
"--$$,$$$.&&"
"--$$,$$$.&&"
"--$$,$$$.&&"

-12345.67
-1234.56
-123.45
-12345.67
-1234.56
-123.45
-12.34
-1.23

-$12,345.67
-b$1,234.56
-bbb$123.45
-$12,345.67
b-$1,234.56
b-bb$123.45
b-bbb$12.34
b-bbbb$1.23

"----,--$.&&"
"----,--$.&&"
"----,--$.&&"
"----,--$.&&"
"----,--$.&&"
"----,--$.&&"

-12345.67
-1234.56
-123.45
-12.34
-1.23
-.12

-$12,345.67
b-$1,234.56
bbb-$123.45
bbbb-$12.34
bbbbb-$1.23
bbbbbb-$.12

"$***,***.&&"
"$***,***.&&"
"$***,***.&&"
"$***,***.&&"
"$***,***.&&"
"$***,***.&&"

12345.67
1234.56
123.45
12.34
1.23
0.12

$*12,345.67
$**1,234.56
$****123.45
$*****12.34
$******1.23
$*******.12

"($$$,$$$.&&)"
"($$$,$$$.&&)"
"($$$,$$$.&&)"

-12345.67
-1234.56
-123.45

($12,345.67)
(b$1,234.56)
(bbb$123.45)

"(($$,$$$.&&)"
"(($$,$$$.&&)"
"(($$,$$$.&&)"
"(($$,$$$.&&)"
"(($$,$$$.&&)"
"((((,(($.&&)"
"((((,(($.&&)"
"((((,(($.&&)"
"((((,(($.&&)"
"((((,(($.&&)"
"((((,(($.&&)"

-12345.67
-1234.56
-123.45
-12.34
-1.23
-12345.67
-1234.56
-123.45
-12.34
-1.23
-.12

($12,345.67)
b($1,234.56)
b(bb$123.45)
b(bbb$12.34)
b(bbbb$1.23)
($12,345.67)
b($1,234.56)
bbb($123.45)
bbbb($12.34)
bbbbb($1.23)
bbbbbb($.12)

"($$$,$$$.&&)"
"($$$,$$$.&&)"
"($$$,$$$.&&)"

12345.67
1234.56
123.45

b$12,345.67
bb$1,234.56
bbbb$123.45

“(($$,$$$.&&)”
"(($$,$$$.&&)"
"(($$,$$$.&&)"
"(($$,$$$.&&)"
"(($$,$$$.&&)"

12345.67
1234.56
123.45
12.34
1.23

b$12,345.67
bb$1,234.56
bbbb$123.45
bbbbb$12.34
bbbbbb$1.23

"((((,(($.&&)"
"((((,(($.&&)"
"((((,(($.&&)"
"((((,(($.&&)"
"((((,(($.&&)"
"((((,(($.&&)"

12345.67
1234.56
123.45
12.34
1.23
0.12

b$12,345.67
bb$1,234.56
bbbb$123.45
bbbbb$12.34
bbbbbb$1.23
bbbbbbb$.12

"<<<,<<<"
"<<<,<<<"
"<<<,<<<"
"<<<,<<<"

12345
1234
123
12

12,345
1,234
123
12


Copyright© 2019 HCL Technologies Limited