mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-16 21:16:57 +00:00
Adjust regexp for an explicit 0 for a decimals value when using Currency and Accounting Number Format Wizards with a locale, to require at least one digit after a dot to ensure this is a decimal and not a text literal
This commit is contained in:
@@ -55,7 +55,7 @@ class Accounting extends Currency
|
||||
$formatter = new Locale($this->fullLocale, NumberFormatter::CURRENCY_ACCOUNTING);
|
||||
$mask = $formatter->format();
|
||||
if ($this->decimals === 0) {
|
||||
$mask = (string) preg_replace('/\.0*/', '', $mask);
|
||||
$mask = (string) preg_replace('/\.0+/miu', '', $mask);
|
||||
}
|
||||
|
||||
return str_replace('¤', $this->formatCurrencyCode(), $mask);
|
||||
|
||||
@@ -72,7 +72,7 @@ class Currency extends Number
|
||||
$formatter = new Locale($this->fullLocale, NumberFormatter::CURRENCY);
|
||||
$mask = $formatter->format();
|
||||
if ($this->decimals === 0) {
|
||||
$mask = (string) preg_replace('/\.0*/', '', $mask);
|
||||
$mask = (string) preg_replace('/\.0+/miu', '', $mask);
|
||||
}
|
||||
|
||||
return str_replace('¤', $this->formatCurrencyCode(), $mask);
|
||||
|
||||
Reference in New Issue
Block a user