1
0
mirror of https://github.com/shuchkin/simplexlsxgen.git synced 2023-08-10 21:12:59 +03:00
This commit is contained in:
Sergey Shuchkin 2022-12-15 00:13:39 +06:00
parent 80091bb9be
commit 6d7608f8ca

View File

@ -747,15 +747,16 @@ class SimpleXLSXGen
if (strlen($m[2]) < 3) { if (strlen($m[2]) < 3) {
$N = self::N_DEC; $N = self::N_DEC;
} }
} elseif (preg_match('/^(\$)?[-+]?[0-9\.]+( ₽| €)?$/u', $v, $m)) { // currency? } elseif (preg_match('/^\$[-+]?[0-9\.]+$/', $v)) { // currency $?
if ($m[1] === '$') {
$N = self::N_DOLLAR; $N = self::N_DOLLAR;
} elseif ($m[2] === ' ₽') { $cv = ltrim($v, '+$');
} elseif (preg_match('/^[-+]?[0-9\.]+( ₽| €)$/u', $v, $m)) { // currency ₽ €?
if ($m[1] === ' ₽') {
$N = self::N_RUB; $N = self::N_RUB;
} elseif ($m[2] === ' €') { } elseif ($m[1] === ' €') {
$N = self::N_EURO; $N = self::N_EURO;
} }
$cv = trim($v, ' +$₽€'); $cv = trim($v, ' +₽€');
} elseif (preg_match('/^([-+]?\d+)%$/', $v, $m)) { } elseif (preg_match('/^([-+]?\d+)%$/', $v, $m)) {
$cv = round($m[1] / 100, 2); $cv = round($m[1] / 100, 2);
$N = self::N_PERCENT_INT; // [9] 0% $N = self::N_PERCENT_INT; // [9] 0%