Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

数字转中文大写存在bug #17

Open
liyiliang opened this issue Dec 2, 2021 · 0 comments
Open

数字转中文大写存在bug #17

liyiliang opened this issue Dec 2, 2021 · 0 comments

Comments

@liyiliang
Copy link

` public function toChinese($number, $options = [])
{
if (!static::verifyNumber($number))
{
throw new \InvalidArgumentException(sprintf('%s is not a valied number', $number));
}

    list($integer, $decimal) = explode('.', $number . '.');

    if ($integer < 0)
    {
        $pom = static::$numberMap['-'];
        $integer = abs($integer);
    }
    else
    {
        $pom = '';
    }

    if ($integer > 0)
    {
        return $pom . static::parseInteger($integer, $options) . static::parseDecimal($decimal, $options);
    }
    elseif (!$decimal)
    {
        return static::$numberMap[0] . static::$moneyUnitMap[0][0];
    }
    else
    {
        return $pom . static::parseDecimal($decimal, $options);
    }
}`

判断正负的时候应该使用number来判断。现在 -0.09这种都转为零玖分,应该是负零玖分

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant