2016-08-16 12:00:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// value, format, result
|
|
|
|
|
|
|
|
return [
|
|
|
|
[
|
|
|
|
'0.0',
|
2017-01-23 05:49:10 +00:00
|
|
|
0.0,
|
2016-08-16 12:00:19 +00:00
|
|
|
'0.0',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'0',
|
2017-01-23 05:49:10 +00:00
|
|
|
0.0,
|
2016-08-16 12:00:19 +00:00
|
|
|
'0',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'0.0',
|
2017-01-23 05:49:10 +00:00
|
|
|
0,
|
2016-08-16 12:00:19 +00:00
|
|
|
'0.0',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'0',
|
2017-01-23 05:49:10 +00:00
|
|
|
0,
|
2016-08-16 12:00:19 +00:00
|
|
|
'0',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'000',
|
2016-08-16 12:00:19 +00:00
|
|
|
0,
|
|
|
|
'##0',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'12.0',
|
2016-08-16 12:00:19 +00:00
|
|
|
12,
|
|
|
|
'#.0#',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'0.1',
|
2016-08-16 12:00:19 +00:00
|
|
|
0.10000000000000001,
|
|
|
|
'0.0',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'0',
|
2017-01-23 05:49:10 +00:00
|
|
|
0.10000000000000001,
|
2016-08-16 12:00:19 +00:00
|
|
|
'0',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'5.556',
|
2016-08-16 12:00:19 +00:00
|
|
|
5.5555000000000003,
|
|
|
|
'0.###',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'5.556',
|
2016-08-16 12:00:19 +00:00
|
|
|
5.5555000000000003,
|
|
|
|
'0.0##',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'5.556',
|
2016-08-16 12:00:19 +00:00
|
|
|
5.5555000000000003,
|
|
|
|
'0.00#',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'5.556',
|
2016-08-16 12:00:19 +00:00
|
|
|
5.5555000000000003,
|
|
|
|
'0.000',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'5.5555',
|
2016-08-16 12:00:19 +00:00
|
|
|
5.5555000000000003,
|
|
|
|
'0.0000',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'12,345.68',
|
2016-08-16 12:00:19 +00:00
|
|
|
12345.678900000001,
|
|
|
|
'#,##0.00',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'12,345.679',
|
2016-08-16 12:00:19 +00:00
|
|
|
12345.678900000001,
|
|
|
|
'#,##0.000',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'£ 12,345.68',
|
2016-08-16 12:00:19 +00:00
|
|
|
12345.678900000001,
|
|
|
|
'£ #,##0.00',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'$ 12,345.679',
|
2016-08-16 12:00:19 +00:00
|
|
|
12345.678900000001,
|
|
|
|
'$ #,##0.000',
|
|
|
|
],
|
2019-05-30 09:37:48 +00:00
|
|
|
[
|
|
|
|
'12,345.679 €',
|
|
|
|
12345.678900000001,
|
|
|
|
'#,##0.000\ [$€-1]',
|
|
|
|
],
|
2016-08-16 12:00:19 +00:00
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'5.68',
|
2016-08-16 12:00:19 +00:00
|
|
|
5.6788999999999996,
|
|
|
|
'#,##0.00',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'12,000',
|
2016-08-16 12:00:19 +00:00
|
|
|
12000,
|
|
|
|
'#,###',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
12,
|
2016-08-16 12:00:19 +00:00
|
|
|
12000,
|
|
|
|
'#,',
|
|
|
|
],
|
|
|
|
// Scaling test
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
12.199999999999999,
|
2016-08-16 12:00:19 +00:00
|
|
|
12200000,
|
|
|
|
'0.0,,',
|
|
|
|
],
|
2019-07-14 17:36:34 +00:00
|
|
|
// Percentage
|
|
|
|
[
|
|
|
|
'12%',
|
|
|
|
0.12,
|
|
|
|
'0%',
|
|
|
|
],
|
2016-08-16 12:00:19 +00:00
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'8%',
|
2016-08-16 12:00:19 +00:00
|
|
|
0.080000000000000002,
|
|
|
|
'0%',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'80%',
|
2016-08-16 12:00:19 +00:00
|
|
|
0.80000000000000004,
|
|
|
|
'0%',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'280%',
|
2016-08-16 12:00:19 +00:00
|
|
|
2.7999999999999998,
|
|
|
|
'0%',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'$125.74 Surplus',
|
2016-08-16 12:00:19 +00:00
|
|
|
125.73999999999999,
|
|
|
|
'$0.00" Surplus";$-0.00" Shortage"',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'$-125.74 Shortage',
|
2016-08-16 12:00:19 +00:00
|
|
|
-125.73999999999999,
|
|
|
|
'$0.00" Surplus";$-0.00" Shortage"',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'$125.74 Shortage',
|
2016-08-16 12:00:19 +00:00
|
|
|
-125.73999999999999,
|
|
|
|
'$0.00" Surplus";$0.00" Shortage"',
|
|
|
|
],
|
|
|
|
// Fraction
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'5 1/4',
|
2016-08-16 12:00:19 +00:00
|
|
|
5.25,
|
|
|
|
'# ???/???',
|
|
|
|
],
|
|
|
|
// Vulgar Fraction
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'5 3/10',
|
2016-08-16 12:00:19 +00:00
|
|
|
5.2999999999999998,
|
|
|
|
'# ???/???',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'21/4',
|
2016-08-16 12:00:19 +00:00
|
|
|
5.25,
|
|
|
|
'???/???',
|
|
|
|
],
|
2019-07-15 20:05:59 +00:00
|
|
|
// Complex formats
|
2016-08-16 12:00:19 +00:00
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'(001) 2-3456-789',
|
2016-08-16 12:00:19 +00:00
|
|
|
123456789,
|
|
|
|
'(000) 0-0000-000',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'0 (+00) 0123 45 67 89',
|
2016-08-16 12:00:19 +00:00
|
|
|
123456789,
|
|
|
|
'0 (+00) 0000 00 00 00',
|
|
|
|
],
|
2019-07-15 20:05:59 +00:00
|
|
|
[
|
|
|
|
'002-01-0035-7',
|
|
|
|
20100357,
|
|
|
|
'000-00-0000-0',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'002-01-00.35-7',
|
|
|
|
20100.357,
|
|
|
|
'000-00-00.00-0',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'002.01.0035.7',
|
|
|
|
20100357,
|
|
|
|
'000\.00\.0000\.0',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'002.01.00.35.7',
|
|
|
|
20100.357,
|
|
|
|
'000\.00\.00.00\.0',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'002.01.00.35.70',
|
|
|
|
20100.357,
|
|
|
|
'000\.00\.00.00\.00',
|
|
|
|
],
|
2016-08-16 12:00:19 +00:00
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'12345:67:89',
|
2016-08-16 12:00:19 +00:00
|
|
|
123456789,
|
|
|
|
'0000:00:00',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'-12345:67:89',
|
2016-08-16 12:00:19 +00:00
|
|
|
-123456789,
|
|
|
|
'0000:00:00',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'12345:67.89',
|
2016-08-16 12:00:19 +00:00
|
|
|
1234567.8899999999,
|
|
|
|
'0000:00.00',
|
|
|
|
],
|
|
|
|
[
|
2017-01-23 05:49:10 +00:00
|
|
|
'-12345:67.89',
|
2016-08-16 12:00:19 +00:00
|
|
|
-1234567.8899999999,
|
|
|
|
'0000:00.00',
|
|
|
|
],
|
2018-09-28 12:28:40 +00:00
|
|
|
[
|
|
|
|
'18.952',
|
|
|
|
18.952,
|
|
|
|
'[$-409]General',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'9.98',
|
|
|
|
9.98,
|
|
|
|
'[$-409]#,##0.00;-#,##0.00',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'18.952',
|
|
|
|
18.952,
|
|
|
|
'[$-1010409]General',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'9.98',
|
|
|
|
9.98,
|
|
|
|
'[$-1010409]#,##0.00;-#,##0.00',
|
|
|
|
],
|
2019-05-30 07:18:03 +00:00
|
|
|
[
|
|
|
|
' $ 23.06 ',
|
|
|
|
23.0597,
|
|
|
|
'_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
' € 13.03 ',
|
|
|
|
13.0316,
|
|
|
|
'_("€"* #,##0.00_);_("€"* \(#,##0.00\);_("€"* "-"??_);_(@_)',
|
|
|
|
],
|
2019-07-14 17:36:34 +00:00
|
|
|
// Named colours
|
|
|
|
// Simple color
|
|
|
|
[
|
|
|
|
'12345',
|
|
|
|
12345,
|
|
|
|
'[Green]General',
|
|
|
|
],
|
2019-07-15 20:05:59 +00:00
|
|
|
[
|
|
|
|
'-70',
|
|
|
|
-70,
|
|
|
|
'#,##0;[Red]-#,##0'
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'-12,345',
|
|
|
|
-12345,
|
|
|
|
'#,##0;[Red]-#,##0'
|
|
|
|
],
|
2019-07-14 17:36:34 +00:00
|
|
|
// Multiple colors
|
|
|
|
[
|
|
|
|
'12345',
|
|
|
|
12345,
|
|
|
|
'[Blue]0;[Red]0',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Positive',
|
|
|
|
12,
|
|
|
|
'[Green]"Positive";[Red]"Negative";[Blue]"Zero"',
|
|
|
|
],
|
2019-07-15 20:05:59 +00:00
|
|
|
// Multiple colors with text substitution
|
2019-07-14 17:36:34 +00:00
|
|
|
[
|
|
|
|
'Zero',
|
|
|
|
0,
|
|
|
|
'[Green]"Positive";[Red]"Negative";[Blue]"Zero"',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'Negative',
|
|
|
|
-2,
|
|
|
|
'[Green]"Positive";[Red]"Negative";[Blue]"Zero"',
|
|
|
|
],
|
2016-08-16 12:00:19 +00:00
|
|
|
];
|