[Qt-interest] A way to test the number of digits after a decimal point?

Jesús Fernández jsfdez at gmail.com
Tue Mar 31 18:14:39 CEST 2009


What about using a QRegExp?

QRegExp rx("(\\d+)\\.?(\\d*)");

The second captured string will give you the digits after the decimal point
if exists.

On Tue, Mar 31, 2009 at 11:24 AM, Mihail Naydenov <mlists at ymail.com> wrote:

>
> I need to test a string, representing a double, for the number of digits
> after a decimal point.
>
> Looking into QDoubleValidator code, it uses
> locale().d()->validateChars(...), which also tests for the notation type,
> but this is a private method, so it is a no-go.
> Were can I find a public alternative to these? Because both QString and
> QLocal does not seam to have one.
>
> Thank You
> MihailNaydenov
>
>
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090331/e0a52bb1/attachment.html 


More information about the Qt-interest-old mailing list