NumberFormat.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494
  1. <?php
  2. use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
  3. // value, format, result
  4. return [
  5. [
  6. '0.0',
  7. 0.0,
  8. '0.0',
  9. ],
  10. [
  11. '0',
  12. 0.0,
  13. '0',
  14. ],
  15. [
  16. '0.0',
  17. 0,
  18. '0.0',
  19. ],
  20. [
  21. '0',
  22. 0,
  23. '0',
  24. ],
  25. [
  26. '000',
  27. 0,
  28. '##0',
  29. ],
  30. [
  31. '12.00',
  32. 12,
  33. '#.0#',
  34. ],
  35. [
  36. '0.1',
  37. 0.10000000000000001,
  38. '0.0',
  39. ],
  40. [
  41. '0',
  42. 0.10000000000000001,
  43. '0',
  44. ],
  45. [
  46. '5.556',
  47. 5.5555000000000003,
  48. '0.###',
  49. ],
  50. [
  51. '5.556',
  52. 5.5555000000000003,
  53. '0.0##',
  54. ],
  55. [
  56. '5.556',
  57. 5.5555000000000003,
  58. '0.00#',
  59. ],
  60. [
  61. '12 345.67',
  62. 12345.67,
  63. '#\ ##0.00',
  64. ],
  65. [
  66. '1234 567.00',
  67. 1234567.00,
  68. '#\ ##0.00',
  69. ],
  70. [
  71. '5.556',
  72. 5.5555000000000003,
  73. '0.000',
  74. ],
  75. [
  76. '5.5555',
  77. 5.5555000000000003,
  78. '0.0000',
  79. ],
  80. [
  81. '12,345.68',
  82. 12345.678900000001,
  83. '#,##0.00',
  84. ],
  85. [
  86. '12,345.679',
  87. 12345.678900000001,
  88. '#,##0.000',
  89. ],
  90. [
  91. '12.34 kg',
  92. 12.34,
  93. '0.00 "kg"',
  94. ],
  95. [
  96. 'kg 12.34',
  97. 12.34,
  98. '"kg" 0.00',
  99. ],
  100. [
  101. '12.34 kg.',
  102. 12.34,
  103. '0.00 "kg."',
  104. ],
  105. [
  106. 'kg. 12.34',
  107. 12.34,
  108. '"kg." 0.00',
  109. ],
  110. [
  111. '£ 12,345.68',
  112. 12345.678900000001,
  113. '£ #,##0.00',
  114. ],
  115. [
  116. '$ 12,345.679',
  117. 12345.678900000001,
  118. '$ #,##0.000',
  119. ],
  120. [
  121. '12,345.679 €',
  122. 12345.678900000001,
  123. '#,##0.000\ [$€-1]',
  124. ],
  125. [
  126. '12,345.679 $',
  127. 12345.678900000001,
  128. '#,##0.000\ [$]',
  129. ],
  130. 'Spacing Character' => [
  131. '826.00 €',
  132. 826,
  133. '#,##0.00 __€',
  134. ],
  135. [
  136. '5.68',
  137. 5.6788999999999996,
  138. '#,##0.00',
  139. ],
  140. [
  141. '12,000',
  142. 12000,
  143. '#,###',
  144. ],
  145. [
  146. '12',
  147. 12000,
  148. '#,',
  149. ],
  150. // Scaling test
  151. [
  152. '12.2',
  153. 12200000,
  154. '0.0,,',
  155. ],
  156. // Percentage
  157. [
  158. '12%',
  159. 0.12,
  160. '0%',
  161. ],
  162. [
  163. '8%',
  164. 0.080000000000000002,
  165. '0%',
  166. ],
  167. [
  168. '80%',
  169. 0.80000000000000004,
  170. '0%',
  171. ],
  172. [
  173. '280%',
  174. 2.7999999999999998,
  175. '0%',
  176. ],
  177. [
  178. '$125.74 Surplus',
  179. 125.73999999999999,
  180. '$0.00" Surplus";$-0.00" Shortage"',
  181. ],
  182. [
  183. '$-125.74 Shortage',
  184. -125.73999999999999,
  185. '$0.00" Surplus";$-0.00" Shortage"',
  186. ],
  187. [
  188. '$125.74 Shortage',
  189. -125.73999999999999,
  190. '$0.00" Surplus";$0.00" Shortage"',
  191. ],
  192. [
  193. '12%',
  194. 0.123,
  195. '0%',
  196. ],
  197. [
  198. '10%',
  199. 0.1,
  200. '0%',
  201. ],
  202. [
  203. '10.0%',
  204. 0.1,
  205. '0.0%',
  206. ],
  207. [
  208. '-12%',
  209. -0.123,
  210. '0%',
  211. ],
  212. [
  213. '12.3 %',
  214. 0.123,
  215. '0.?? %',
  216. ],
  217. [
  218. '12.35 %',
  219. 0.12345,
  220. '0.?? %',
  221. ],
  222. [
  223. '12.345 %',
  224. 0.12345,
  225. '0.00?? %',
  226. ],
  227. [
  228. '12.3457 %',
  229. 0.123456789,
  230. '0.00?? %',
  231. ],
  232. [
  233. '-12.3 %',
  234. -0.123,
  235. '0.?? %',
  236. ],
  237. [
  238. '12.30 %age',
  239. 0.123,
  240. '0.00 %"age"',
  241. ],
  242. [
  243. '-12.30 %age',
  244. -0.123,
  245. '0.00 %"age"',
  246. ],
  247. [
  248. '12.30%',
  249. 0.123,
  250. '0.00%;(0.00%)',
  251. ],
  252. [
  253. '(12.30%)',
  254. -0.123,
  255. '0.00%;(0.00%)',
  256. ],
  257. [
  258. '12.30% ',
  259. 0.123,
  260. '0.00%_;( 0.00% )',
  261. ],
  262. [
  263. '( 12.30% )',
  264. -0.123,
  265. '_(0.00%_;( 0.00% )',
  266. ],
  267. // Fraction
  268. [
  269. '5 1/4',
  270. 5.25,
  271. '# ???/???',
  272. ],
  273. // Vulgar Fraction
  274. [
  275. '5 3/10',
  276. 5.2999999999999998,
  277. '# ???/???',
  278. ],
  279. [
  280. '21/4',
  281. 5.25,
  282. '???/???',
  283. ],
  284. [
  285. '0 3/4',
  286. 0.75,
  287. '0??/???',
  288. ],
  289. [
  290. '3/4',
  291. 0.75,
  292. '#??/???',
  293. ],
  294. [
  295. ' 3/4',
  296. 0.75,
  297. '? ??/???',
  298. ],
  299. [
  300. ' 3/4',
  301. '0.75000',
  302. '? ??/???',
  303. ],
  304. [
  305. '5 1/16',
  306. 5.0625,
  307. '? ??/???',
  308. ],
  309. [
  310. '- 5/8',
  311. -0.625,
  312. '? ??/???',
  313. ],
  314. [
  315. '0',
  316. 0,
  317. '? ??/???',
  318. ],
  319. [
  320. '0',
  321. '0.000',
  322. '? ??/???',
  323. ],
  324. [
  325. '-16',
  326. '-016.0',
  327. '? ??/???',
  328. ],
  329. // Complex formats
  330. [
  331. '(001) 2-3456-789',
  332. 123456789,
  333. '(000) 0-0000-000',
  334. ],
  335. [
  336. '0 (+00) 0123 45 67 89',
  337. 123456789,
  338. '0 (+00) 0000 00 00 00',
  339. ],
  340. [
  341. '002-01-0035-7',
  342. 20100357,
  343. '000-00-0000-0',
  344. ],
  345. [
  346. '002-01-00.35-7',
  347. 20100.357,
  348. '000-00-00.00-0',
  349. ],
  350. [
  351. '002.01.0035.7',
  352. 20100357,
  353. '000\.00\.0000\.0',
  354. ],
  355. [
  356. '002.01.00.35.7',
  357. 20100.357,
  358. '000\.00\.00.00\.0',
  359. ],
  360. [
  361. '002.01.00.35.70',
  362. 20100.357,
  363. '000\.00\.00.00\.00',
  364. ],
  365. [
  366. '12345:67:89',
  367. 123456789,
  368. '0000:00:00',
  369. ],
  370. [
  371. '-12345:67:89',
  372. -123456789,
  373. '0000:00:00',
  374. ],
  375. [
  376. '12345:67.89',
  377. 1234567.8899999999,
  378. '0000:00.00',
  379. ],
  380. [
  381. '-12345:67.89',
  382. -1234567.8899999999,
  383. '0000:00.00',
  384. ],
  385. [
  386. '18.952',
  387. 18.952,
  388. '[$-409]General',
  389. ],
  390. [
  391. '9.98',
  392. 9.98,
  393. '[$-409]#,##0.00;-#,##0.00',
  394. ],
  395. [
  396. '18.952',
  397. 18.952,
  398. '[$-1010409]General',
  399. ],
  400. [
  401. '9.98',
  402. 9.98,
  403. '[$-1010409]#,##0.00;-#,##0.00',
  404. ],
  405. [
  406. ' $ 23.06 ',
  407. 23.0597,
  408. '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)',
  409. ],
  410. [
  411. ' € (13.03)',
  412. -13.0316,
  413. '_("€"* #,##0.00_);_("€"* \(#,##0.00\);_("€"* "-"??_);_(@_)',
  414. ],
  415. [
  416. ' € 11.70 ',
  417. 11.7,
  418. '_-€* #,##0.00_-;"-€"* #,##0.00_-;_-€* -??_-;_-@_-',
  419. ],
  420. [
  421. '-€ 12.14 ',
  422. -12.14,
  423. '_-€* #,##0.00_-;"-€"* #,##0.00_-;_-€* -??_-;_-@_-',
  424. ],
  425. [
  426. ' € - ',
  427. 0,
  428. '_-€* #,##0.00_-;"-€"* #,##0.00_-;_-€* -??_-;_-@_-',
  429. ],
  430. [
  431. 'test',
  432. 'test',
  433. '_-€* #,##0.00_-;"-€"* #,##0.00_-;_-€* -??_-;_-@_-',
  434. ],
  435. // Named colours
  436. // Simple color
  437. [
  438. '12345',
  439. 12345,
  440. '[Green]General',
  441. ],
  442. [
  443. '12345',
  444. 12345,
  445. '[GrEeN]General',
  446. ],
  447. [
  448. '-70',
  449. -70,
  450. '#,##0;[Red]-#,##0',
  451. ],
  452. [
  453. '-12,345',
  454. -12345,
  455. '#,##0;[Red]-#,##0',
  456. ],
  457. // Multiple colors
  458. [
  459. '12345',
  460. 12345,
  461. '[Blue]0;[Red]0-',
  462. ],
  463. [
  464. '12345-',
  465. -12345,
  466. '[BLUE]0;[red]0-',
  467. ],
  468. [
  469. '12345-',
  470. -12345,
  471. '[blue]0;[RED]0-',
  472. ],
  473. // Multiple colors with text substitution
  474. [
  475. 'Positive',
  476. 12,
  477. '[Green]"Positive";[Red]"Negative";[Blue]"Zero"',
  478. ],
  479. [
  480. 'Zero',
  481. 0,
  482. '[Green]"Positive";[Red]"Negative";[Blue]"Zero"',
  483. ],
  484. [
  485. 'Negative',
  486. -2,
  487. '[Green]"Positive";[Red]"Negative";[Blue]"Zero"',
  488. ],
  489. // Value break points
  490. [
  491. '<=3500 red',
  492. 3500,
  493. '[Green][=17]"=17 green";[Red][<=3500]"<=3500 red";[Blue]"Zero"',
  494. ],
  495. [
  496. '=17 green',
  497. 17,
  498. '[Green][=17]"=17 green";[Red][<=3500]"<=3500 red";[Blue]"Zero"',
  499. ],
  500. [
  501. '<>25 green',
  502. 17,
  503. '[Green][<>25]"<>25 green";[Red]"else red"',
  504. ],
  505. [
  506. 'else red',
  507. 25,
  508. '[Green][<>25]"<>25 green";[Red]"else red"',
  509. ],
  510. // Leading/trailing quotes in mask
  511. [
  512. '$12.34 ',
  513. 12.34,
  514. '$#,##0.00_;[RED]"($"#,##0.00")"',
  515. ],
  516. [
  517. '($12.34)',
  518. -12.34,
  519. '$#,##0.00_;[RED]"($"#,##0.00")"',
  520. ],
  521. [
  522. 'pfx. 25.00',
  523. 25,
  524. '"pfx." 0.00;"pfx." -0.00;"pfx." 0.00;',
  525. ],
  526. [
  527. 'pfx. 25.20',
  528. 25.2,
  529. '"pfx." 0.00;"pfx." -0.00;"pfx." 0.00;',
  530. ],
  531. [
  532. 'pfx. -25.20',
  533. -25.2,
  534. '"pfx." 0.00;"pfx." -0.00;"pfx." 0.00;',
  535. ],
  536. [
  537. 'pfx. 25.26',
  538. 25.255555555555555,
  539. '"pfx." 0.00;"pfx." -0.00;"pfx." 0.00;',
  540. ],
  541. [
  542. '1',
  543. '1.000',
  544. NumberFormat::FORMAT_NUMBER,
  545. ],
  546. [
  547. '-1',
  548. '-1.000',
  549. NumberFormat::FORMAT_NUMBER,
  550. ],
  551. [
  552. '1',
  553. '1',
  554. NumberFormat::FORMAT_NUMBER,
  555. ],
  556. [
  557. '-1',
  558. '-1',
  559. NumberFormat::FORMAT_NUMBER,
  560. ],
  561. [
  562. '0',
  563. '0',
  564. NumberFormat::FORMAT_NUMBER,
  565. ],
  566. [
  567. '0',
  568. '-0',
  569. NumberFormat::FORMAT_NUMBER,
  570. ],
  571. [
  572. '1',
  573. '1.1',
  574. NumberFormat::FORMAT_NUMBER,
  575. ],
  576. [
  577. '1',
  578. '1.4',
  579. NumberFormat::FORMAT_NUMBER,
  580. ],
  581. [
  582. '2',
  583. '1.5',
  584. NumberFormat::FORMAT_NUMBER,
  585. ],
  586. [
  587. '2',
  588. '1.9',
  589. NumberFormat::FORMAT_NUMBER,
  590. ],
  591. [
  592. '1.0',
  593. '1.000',
  594. NumberFormat::FORMAT_NUMBER_0,
  595. ],
  596. [
  597. '-1.0',
  598. '-1.000',
  599. NumberFormat::FORMAT_NUMBER_0,
  600. ],
  601. [
  602. '1.0',
  603. '1',
  604. NumberFormat::FORMAT_NUMBER_0,
  605. ],
  606. [
  607. '-1.0',
  608. '-1',
  609. NumberFormat::FORMAT_NUMBER_0,
  610. ],
  611. [
  612. '1.0',
  613. '1',
  614. NumberFormat::FORMAT_NUMBER_0,
  615. ],
  616. [
  617. '0.0',
  618. '0',
  619. NumberFormat::FORMAT_NUMBER_0,
  620. ],
  621. [
  622. '0.0',
  623. '-0',
  624. NumberFormat::FORMAT_NUMBER_0,
  625. ],
  626. [
  627. '1.1',
  628. '1.11',
  629. NumberFormat::FORMAT_NUMBER_0,
  630. ],
  631. [
  632. '1.1',
  633. '1.14',
  634. NumberFormat::FORMAT_NUMBER_0,
  635. ],
  636. [
  637. '1.2',
  638. '1.15',
  639. NumberFormat::FORMAT_NUMBER_0,
  640. ],
  641. [
  642. '1.2',
  643. '1.19',
  644. NumberFormat::FORMAT_NUMBER_0,
  645. ],
  646. [
  647. '0.00',
  648. '0',
  649. NumberFormat::FORMAT_NUMBER_00,
  650. ],
  651. [
  652. '1.00',
  653. '1',
  654. NumberFormat::FORMAT_NUMBER_00,
  655. ],
  656. [
  657. '1.11',
  658. '1.111',
  659. NumberFormat::FORMAT_NUMBER_00,
  660. ],
  661. [
  662. '1.11',
  663. '1.114',
  664. NumberFormat::FORMAT_NUMBER_00,
  665. ],
  666. [
  667. '1.12',
  668. '1.115',
  669. NumberFormat::FORMAT_NUMBER_00,
  670. ],
  671. [
  672. '1.12',
  673. '1.119',
  674. NumberFormat::FORMAT_NUMBER_00,
  675. ],
  676. [
  677. '0.00',
  678. '-0',
  679. NumberFormat::FORMAT_NUMBER_00,
  680. ],
  681. [
  682. '-1.00',
  683. '-1',
  684. NumberFormat::FORMAT_NUMBER_00,
  685. ],
  686. [
  687. '-1.11',
  688. '-1.111',
  689. NumberFormat::FORMAT_NUMBER_00,
  690. ],
  691. [
  692. '-1.11',
  693. '-1.114',
  694. NumberFormat::FORMAT_NUMBER_00,
  695. ],
  696. [
  697. '-1.12',
  698. '-1.115',
  699. NumberFormat::FORMAT_NUMBER_00,
  700. ],
  701. [
  702. '-1.12',
  703. '-1.119',
  704. NumberFormat::FORMAT_NUMBER_00,
  705. ],
  706. [
  707. '0.00',
  708. '0',
  709. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
  710. ],
  711. [
  712. '1,000.00',
  713. '1000',
  714. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
  715. ],
  716. [
  717. '1,111.11',
  718. '1111.111',
  719. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
  720. ],
  721. [
  722. '1,111.11',
  723. '1111.114',
  724. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
  725. ],
  726. [
  727. '1,111.12',
  728. '1111.115',
  729. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
  730. ],
  731. [
  732. '1,111.12',
  733. '1111.119',
  734. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
  735. ],
  736. [
  737. '0.00',
  738. '-0',
  739. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
  740. ],
  741. [
  742. '-1,111.00',
  743. '-1111',
  744. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
  745. ],
  746. [
  747. '-1,111.11',
  748. '-1111.111',
  749. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
  750. ],
  751. [
  752. '-1,111.11',
  753. '-1111.114',
  754. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
  755. ],
  756. [
  757. '-1,111.12',
  758. '-1111.115',
  759. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
  760. ],
  761. [
  762. '-1,111.12',
  763. '-1111.119',
  764. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
  765. ],
  766. [
  767. '0.00 ',
  768. '0',
  769. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
  770. ],
  771. [
  772. '1,000.00 ',
  773. '1000',
  774. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
  775. ],
  776. [
  777. '1,111.11 ',
  778. '1111.111',
  779. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
  780. ],
  781. [
  782. '1,111.11 ',
  783. '1111.114',
  784. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
  785. ],
  786. [
  787. '1,111.12 ',
  788. '1111.115',
  789. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
  790. ],
  791. [
  792. '1,111.12 ',
  793. '1111.119',
  794. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
  795. ],
  796. [
  797. '0.00 ',
  798. '-0',
  799. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
  800. ],
  801. [
  802. '-1,111.00 ',
  803. '-1111',
  804. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
  805. ],
  806. [
  807. '-1,111.11 ',
  808. '-1111.111',
  809. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
  810. ],
  811. [
  812. '-1,111.11 ',
  813. '-1111.114',
  814. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
  815. ],
  816. [
  817. '-1,111.12 ',
  818. '-1111.115',
  819. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
  820. ],
  821. [
  822. '-1,111.12 ',
  823. '-1111.119',
  824. NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2,
  825. ],
  826. [
  827. '0%',
  828. '0',
  829. NumberFormat::FORMAT_PERCENTAGE,
  830. ],
  831. [
  832. '1%',
  833. '0.01',
  834. NumberFormat::FORMAT_PERCENTAGE,
  835. ],
  836. [
  837. '1%',
  838. '0.011',
  839. NumberFormat::FORMAT_PERCENTAGE,
  840. ],
  841. [
  842. '1%',
  843. '0.014',
  844. NumberFormat::FORMAT_PERCENTAGE,
  845. ],
  846. [
  847. '2%',
  848. '0.015',
  849. NumberFormat::FORMAT_PERCENTAGE,
  850. ],
  851. [
  852. '2%',
  853. '0.019',
  854. NumberFormat::FORMAT_PERCENTAGE,
  855. ],
  856. [
  857. '0%',
  858. '-0',
  859. NumberFormat::FORMAT_PERCENTAGE,
  860. ],
  861. [
  862. '-1%',
  863. '-0.01',
  864. NumberFormat::FORMAT_PERCENTAGE,
  865. ],
  866. [
  867. '-1%',
  868. '-0.011',
  869. NumberFormat::FORMAT_PERCENTAGE,
  870. ],
  871. [
  872. '-1%',
  873. '-0.014',
  874. NumberFormat::FORMAT_PERCENTAGE,
  875. ],
  876. [
  877. '-2%',
  878. '-0.015',
  879. NumberFormat::FORMAT_PERCENTAGE,
  880. ],
  881. [
  882. '-2%',
  883. '-0.019',
  884. NumberFormat::FORMAT_PERCENTAGE,
  885. ],
  886. [
  887. '0.0%',
  888. '0',
  889. NumberFormat::FORMAT_PERCENTAGE_0,
  890. ],
  891. [
  892. '1.0%',
  893. '0.01',
  894. NumberFormat::FORMAT_PERCENTAGE_0,
  895. ],
  896. [
  897. '1.1%',
  898. '0.011',
  899. NumberFormat::FORMAT_PERCENTAGE_0,
  900. ],
  901. [
  902. '1.1%',
  903. '0.0114',
  904. NumberFormat::FORMAT_PERCENTAGE_0,
  905. ],
  906. [
  907. '1.2%',
  908. '0.0115',
  909. NumberFormat::FORMAT_PERCENTAGE_0,
  910. ],
  911. [
  912. '1.2%',
  913. '0.0119',
  914. NumberFormat::FORMAT_PERCENTAGE_0,
  915. ],
  916. [
  917. '0.0%',
  918. '-0',
  919. NumberFormat::FORMAT_PERCENTAGE_0,
  920. ],
  921. [
  922. '-1.0%',
  923. '-0.01',
  924. NumberFormat::FORMAT_PERCENTAGE_0,
  925. ],
  926. [
  927. '-1.1%',
  928. '-0.011',
  929. NumberFormat::FORMAT_PERCENTAGE_0,
  930. ],
  931. [
  932. '-1.1%',
  933. '-0.0114',
  934. NumberFormat::FORMAT_PERCENTAGE_0,
  935. ],
  936. [
  937. '-1.2%',
  938. '-0.0115',
  939. NumberFormat::FORMAT_PERCENTAGE_0,
  940. ],
  941. [
  942. '-1.2%',
  943. '-0.0119',
  944. NumberFormat::FORMAT_PERCENTAGE_0,
  945. ],
  946. [
  947. '0.00%',
  948. '0',
  949. NumberFormat::FORMAT_PERCENTAGE_00,
  950. ],
  951. [
  952. '1.00%',
  953. '0.01',
  954. NumberFormat::FORMAT_PERCENTAGE_00,
  955. ],
  956. [
  957. '1.11%',
  958. '0.0111',
  959. NumberFormat::FORMAT_PERCENTAGE_00,
  960. ],
  961. [
  962. '1.11%',
  963. '0.01114',
  964. NumberFormat::FORMAT_PERCENTAGE_00,
  965. ],
  966. [
  967. '1.12%',
  968. '0.01115',
  969. NumberFormat::FORMAT_PERCENTAGE_00,
  970. ],
  971. [
  972. '1.12%',
  973. '0.01119',
  974. NumberFormat::FORMAT_PERCENTAGE_00,
  975. ],
  976. [
  977. '0.00%',
  978. '-0',
  979. NumberFormat::FORMAT_PERCENTAGE_00,
  980. ],
  981. [
  982. '-1.00%',
  983. '-0.01',
  984. NumberFormat::FORMAT_PERCENTAGE_00,
  985. ],
  986. [
  987. '-1.11%',
  988. '-0.0111',
  989. NumberFormat::FORMAT_PERCENTAGE_00,
  990. ],
  991. [
  992. '-1.11%',
  993. '-0.01114',
  994. NumberFormat::FORMAT_PERCENTAGE_00,
  995. ],
  996. [
  997. '-1.12%',
  998. '-0.01115',
  999. NumberFormat::FORMAT_PERCENTAGE_00,
  1000. ],
  1001. [
  1002. '-1.12%',
  1003. '-0.01119',
  1004. NumberFormat::FORMAT_PERCENTAGE_00,
  1005. ],
  1006. [
  1007. '$0.00 ',
  1008. '0',
  1009. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1010. ],
  1011. [
  1012. '$1,000.00 ',
  1013. '1000',
  1014. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1015. ],
  1016. [
  1017. '$1,111.11 ',
  1018. '1111.111',
  1019. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1020. ],
  1021. [
  1022. '$1,111.11 ',
  1023. '1111.114',
  1024. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1025. ],
  1026. [
  1027. '$1,111.12 ',
  1028. '1111.115',
  1029. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1030. ],
  1031. [
  1032. '$1,111.12 ',
  1033. '1111.119',
  1034. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1035. ],
  1036. [
  1037. '$0.00 ',
  1038. '-0',
  1039. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1040. ],
  1041. [
  1042. '$-1,111.00 ',
  1043. '-1111',
  1044. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1045. ],
  1046. [
  1047. '$-1,111.11 ',
  1048. '-1111.111',
  1049. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1050. ],
  1051. [
  1052. '$-1,111.11 ',
  1053. '-1111.114',
  1054. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1055. ],
  1056. [
  1057. '$-1,111.12 ',
  1058. '-1111.115',
  1059. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1060. ],
  1061. [
  1062. '$-1,111.12 ',
  1063. '-1111.119',
  1064. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1065. ],
  1066. [
  1067. '$0 ',
  1068. '0',
  1069. NumberFormat::FORMAT_CURRENCY_USD,
  1070. ],
  1071. [
  1072. '$1,000 ',
  1073. '1000',
  1074. NumberFormat::FORMAT_CURRENCY_USD,
  1075. ],
  1076. [
  1077. '$1,111 ',
  1078. '1111.1',
  1079. NumberFormat::FORMAT_CURRENCY_USD,
  1080. ],
  1081. [
  1082. '$1,111 ',
  1083. '1111.4',
  1084. NumberFormat::FORMAT_CURRENCY_USD,
  1085. ],
  1086. [
  1087. '$1,112 ',
  1088. '1111.5',
  1089. NumberFormat::FORMAT_CURRENCY_USD,
  1090. ],
  1091. [
  1092. '$1,112 ',
  1093. '1111.9',
  1094. NumberFormat::FORMAT_CURRENCY_USD,
  1095. ],
  1096. [
  1097. '$0 ',
  1098. '-0',
  1099. NumberFormat::FORMAT_CURRENCY_USD,
  1100. ],
  1101. [
  1102. '$-1,111 ',
  1103. '-1111',
  1104. NumberFormat::FORMAT_CURRENCY_USD,
  1105. ],
  1106. [
  1107. '$-1,111 ',
  1108. '-1111.1',
  1109. NumberFormat::FORMAT_CURRENCY_USD,
  1110. ],
  1111. [
  1112. '$-1,111 ',
  1113. '-1111.4',
  1114. NumberFormat::FORMAT_CURRENCY_USD,
  1115. ],
  1116. [
  1117. '$-1,112 ',
  1118. '-1111.5',
  1119. NumberFormat::FORMAT_CURRENCY_USD,
  1120. ],
  1121. [
  1122. '$-1,112 ',
  1123. '-1111.9',
  1124. NumberFormat::FORMAT_CURRENCY_USD,
  1125. ],
  1126. [
  1127. '$0.00 ',
  1128. '0',
  1129. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1130. ],
  1131. [
  1132. '$1,000.00 ',
  1133. '1000',
  1134. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1135. ],
  1136. [
  1137. '$1,111.11 ',
  1138. '1111.111',
  1139. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1140. ],
  1141. [
  1142. '$1,111.11 ',
  1143. '1111.114',
  1144. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1145. ],
  1146. [
  1147. '$1,111.12 ',
  1148. '1111.115',
  1149. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1150. ],
  1151. [
  1152. '$1,111.12 ',
  1153. '1111.119',
  1154. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1155. ],
  1156. [
  1157. '$0.00 ',
  1158. '-0',
  1159. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1160. ],
  1161. [
  1162. '$-1,111.00 ',
  1163. '-1111',
  1164. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1165. ],
  1166. [
  1167. '$-1,111.11 ',
  1168. '-1111.111',
  1169. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1170. ],
  1171. [
  1172. '$-1,111.11 ',
  1173. '-1111.114',
  1174. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1175. ],
  1176. [
  1177. '$-1,111.12 ',
  1178. '-1111.115',
  1179. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1180. ],
  1181. [
  1182. '$-1,111.12 ',
  1183. '-1111.119',
  1184. NumberFormat::FORMAT_CURRENCY_USD_SIMPLE,
  1185. ],
  1186. [
  1187. '$0 ',
  1188. '0',
  1189. NumberFormat::FORMAT_CURRENCY_USD,
  1190. ],
  1191. [
  1192. '$1,000 ',
  1193. '1000',
  1194. NumberFormat::FORMAT_CURRENCY_USD,
  1195. ],
  1196. [
  1197. '$1,111 ',
  1198. '1111.1',
  1199. NumberFormat::FORMAT_CURRENCY_USD,
  1200. ],
  1201. [
  1202. '$1,111 ',
  1203. '1111.4',
  1204. NumberFormat::FORMAT_CURRENCY_USD,
  1205. ],
  1206. [
  1207. '$1,112 ',
  1208. '1111.5',
  1209. NumberFormat::FORMAT_CURRENCY_USD,
  1210. ],
  1211. [
  1212. '$1,112 ',
  1213. '1111.9',
  1214. NumberFormat::FORMAT_CURRENCY_USD,
  1215. ],
  1216. [
  1217. '$0 ',
  1218. '-0',
  1219. NumberFormat::FORMAT_CURRENCY_USD,
  1220. ],
  1221. [
  1222. '$-1,111 ',
  1223. '-1111',
  1224. NumberFormat::FORMAT_CURRENCY_USD,
  1225. ],
  1226. [
  1227. '$-1,111 ',
  1228. '-1111.1',
  1229. NumberFormat::FORMAT_CURRENCY_USD,
  1230. ],
  1231. [
  1232. '$-1,111 ',
  1233. '-1111.4',
  1234. NumberFormat::FORMAT_CURRENCY_USD,
  1235. ],
  1236. [
  1237. '$-1,112 ',
  1238. '-1111.5',
  1239. NumberFormat::FORMAT_CURRENCY_USD,
  1240. ],
  1241. [
  1242. '$-1,112 ',
  1243. '-1111.9',
  1244. NumberFormat::FORMAT_CURRENCY_USD,
  1245. ],
  1246. [
  1247. '0.00 €',
  1248. '0',
  1249. NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE,
  1250. ],
  1251. [
  1252. '1,000.00 €',
  1253. '1000',
  1254. NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE,
  1255. ],
  1256. [
  1257. '1,111.11 €',
  1258. '1111.111',
  1259. NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE,
  1260. ],
  1261. [
  1262. '1,111.11 €',
  1263. '1111.114',
  1264. NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE,
  1265. ],
  1266. [
  1267. '1,111.12 €',
  1268. '1111.115',
  1269. NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE,
  1270. ],
  1271. [
  1272. '1,111.12 €',
  1273. '1111.119',
  1274. NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE,
  1275. ],
  1276. [
  1277. '0.00 €',
  1278. '-0',
  1279. NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE,
  1280. ],
  1281. [
  1282. '-1,111.00 €',
  1283. '-1111',
  1284. NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE,
  1285. ],
  1286. [
  1287. '-1,111.11 €',
  1288. '-1111.111',
  1289. NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE,
  1290. ],
  1291. [
  1292. '-1,111.11 €',
  1293. '-1111.114',
  1294. NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE,
  1295. ],
  1296. [
  1297. '-1,111.12 €',
  1298. '-1111.115',
  1299. NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE,
  1300. ],
  1301. [
  1302. '-1,111.12 €',
  1303. '-1111.119',
  1304. NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE,
  1305. ],
  1306. [
  1307. '0 €',
  1308. '0',
  1309. NumberFormat::FORMAT_CURRENCY_EUR,
  1310. ],
  1311. [
  1312. '1,000 €',
  1313. '1000',
  1314. NumberFormat::FORMAT_CURRENCY_EUR,
  1315. ],
  1316. [
  1317. '1,111 €',
  1318. '1111.1',
  1319. NumberFormat::FORMAT_CURRENCY_EUR,
  1320. ],
  1321. [
  1322. '1,111 €',
  1323. '1111.4',
  1324. NumberFormat::FORMAT_CURRENCY_EUR,
  1325. ],
  1326. [
  1327. '1,112 €',
  1328. '1111.5',
  1329. NumberFormat::FORMAT_CURRENCY_EUR,
  1330. ],
  1331. [
  1332. '1,112 €',
  1333. '1111.9',
  1334. NumberFormat::FORMAT_CURRENCY_EUR,
  1335. ],
  1336. [
  1337. '0 €',
  1338. '-0',
  1339. NumberFormat::FORMAT_CURRENCY_EUR,
  1340. ],
  1341. [
  1342. '-1,111 €',
  1343. '-1111',
  1344. NumberFormat::FORMAT_CURRENCY_EUR,
  1345. ],
  1346. [
  1347. '-1,111 €',
  1348. '-1111.1',
  1349. NumberFormat::FORMAT_CURRENCY_EUR,
  1350. ],
  1351. [
  1352. '-1,111 €',
  1353. '-1111.4',
  1354. NumberFormat::FORMAT_CURRENCY_EUR,
  1355. ],
  1356. [
  1357. '-1,112 €',
  1358. '-1111.5',
  1359. NumberFormat::FORMAT_CURRENCY_EUR,
  1360. ],
  1361. [
  1362. '-1,112 €',
  1363. '-1111.9',
  1364. NumberFormat::FORMAT_CURRENCY_EUR,
  1365. ],
  1366. [
  1367. ' $ - ',
  1368. '0',
  1369. NumberFormat::FORMAT_ACCOUNTING_USD,
  1370. ],
  1371. [
  1372. ' $ 1,000.00 ',
  1373. '1000',
  1374. NumberFormat::FORMAT_ACCOUNTING_USD,
  1375. ],
  1376. [
  1377. ' $ 1,111.11 ',
  1378. '1111.111',
  1379. NumberFormat::FORMAT_ACCOUNTING_USD,
  1380. ],
  1381. [
  1382. ' $ 1,111.11 ',
  1383. '1111.114',
  1384. NumberFormat::FORMAT_ACCOUNTING_USD,
  1385. ],
  1386. [
  1387. ' $ 1,111.12 ',
  1388. '1111.115',
  1389. NumberFormat::FORMAT_ACCOUNTING_USD,
  1390. ],
  1391. [
  1392. ' $ 1,111.12 ',
  1393. '1111.119',
  1394. NumberFormat::FORMAT_ACCOUNTING_USD,
  1395. ],
  1396. [
  1397. ' $ - ',
  1398. '-0',
  1399. NumberFormat::FORMAT_ACCOUNTING_USD,
  1400. ],
  1401. [
  1402. ' $ (1,111.00)',
  1403. '-1111',
  1404. NumberFormat::FORMAT_ACCOUNTING_USD,
  1405. ],
  1406. [
  1407. ' $ (1,111.11)',
  1408. '-1111.111',
  1409. NumberFormat::FORMAT_ACCOUNTING_USD,
  1410. ],
  1411. [
  1412. ' $ (1,111.11)',
  1413. '-1111.114',
  1414. NumberFormat::FORMAT_ACCOUNTING_USD,
  1415. ],
  1416. [
  1417. ' $ (1,111.12)',
  1418. '-1111.115',
  1419. NumberFormat::FORMAT_ACCOUNTING_USD,
  1420. ],
  1421. [
  1422. ' $ (1,111.12)',
  1423. '-1111.119',
  1424. NumberFormat::FORMAT_ACCOUNTING_USD,
  1425. ],
  1426. [
  1427. ' € - ',
  1428. '0',
  1429. NumberFormat::FORMAT_ACCOUNTING_EUR,
  1430. ],
  1431. [
  1432. ' € 1,000.00 ',
  1433. '1000',
  1434. NumberFormat::FORMAT_ACCOUNTING_EUR,
  1435. ],
  1436. [
  1437. ' € 1,111.11 ',
  1438. '1111.111',
  1439. NumberFormat::FORMAT_ACCOUNTING_EUR,
  1440. ],
  1441. [
  1442. ' € 1,111.11 ',
  1443. '1111.114',
  1444. NumberFormat::FORMAT_ACCOUNTING_EUR,
  1445. ],
  1446. [
  1447. ' € 1,111.12 ',
  1448. '1111.115',
  1449. NumberFormat::FORMAT_ACCOUNTING_EUR,
  1450. ],
  1451. [
  1452. ' € 1,111.12 ',
  1453. '1111.119',
  1454. NumberFormat::FORMAT_ACCOUNTING_EUR,
  1455. ],
  1456. [
  1457. ' € - ',
  1458. '-0',
  1459. NumberFormat::FORMAT_ACCOUNTING_EUR,
  1460. ],
  1461. [
  1462. ' € (1,111.00)',
  1463. '-1111',
  1464. NumberFormat::FORMAT_ACCOUNTING_EUR,
  1465. ],
  1466. [
  1467. ' € (1,111.11)',
  1468. '-1111.111',
  1469. NumberFormat::FORMAT_ACCOUNTING_EUR,
  1470. ],
  1471. [
  1472. ' € (1,111.11)',
  1473. '-1111.114',
  1474. NumberFormat::FORMAT_ACCOUNTING_EUR,
  1475. ],
  1476. [
  1477. ' € (1,111.12)',
  1478. '-1111.115',
  1479. NumberFormat::FORMAT_ACCOUNTING_EUR,
  1480. ],
  1481. [
  1482. ' € (1,111.12)',
  1483. '-1111.119',
  1484. NumberFormat::FORMAT_ACCOUNTING_EUR,
  1485. ],
  1486. 'issue 1929' => ['(79.3%)', -0.793, '#,##0.0%;(#,##0.0%)'],
  1487. 'percent without leading 0' => ['6.2%', 0.062, '##.0%'],
  1488. 'percent with leading 0' => ['06.2%', 0.062, '00.0%'],
  1489. 'percent lead0 no decimal' => ['06%', 0.062, '00%'],
  1490. 'percent nolead0 no decimal' => ['6%', 0.062, '##%'],
  1491. ];