[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: RE: kdelibs/kdecore
From:       Hans Petter Bieker <bieker () stud ! ntnu ! no>
Date:       1999-09-09 10:55:42
[Download RAW message or body]

On Tue, 7 Sep 1999, David Faure wrote:

> > > formatNumber uses QString().setNum(...). Does that support locales ?
> > 
> > That's only the case if ENABLE_NLS is not defined.
> Which it is usually, right ?

AFAIK it's defined by default.

> Tell me what this is supposed to do :
> QString KLocale::formatNumber(const QString &numStr) const
> {
>   return numStr;
> } 
> nothing :)

Yeah, that's right. But hte code that's in use is this:
QString KLocale::formatNumber(double num) const
{
    bool neg = num < 0;
    QString res = QString::number(neg?-num:num, 'f', fracDigits());
    int pos = res.find('.');
    if (pos == -1) pos = res.length();
    else res.replace(pos, 1, decimalSymbol());

    while (0 < (pos -= 3))
        res.insert(pos, thousandsSeparator()); // thousend sep

    // How can we know where we should put the sign?
    res.prepend(neg?negativeSign():positiveSign());

    return res;
}

QString KLocale::formatNumber(const QString &numStr) const
{
  return formatNumber(numStr.toDouble());
}

Better? :-)

-bieker-

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic