[Qt-interest] I am facing a problem

Sujan Dasmahapatra sujan.dasmahapatra at gmail.com
Wed Aug 12 17:39:55 CEST 2009


Oh Thanks so much Mr Thomas. I am checking it now Thanks a lot.

On Wed, Aug 12, 2009 at 6:32 PM, Thomas Dähling
<t.daehling at googlemail.com>wrote:

> I hate repeating myself, but take a look at the QValidator
> specializations provided by the Trolls, namely QIntValidator and
> QDoubleValidator.
>
> /Thomas
>
> 2009/8/12 Sujan Dasmahapatra <sujan.dasmahapatra at gmail.com>:
>  > I am reading an int and a double from file. Can u tell me how could I
> check
> > whether it's an int or double.
> >
> > something like
> >
> >
> > int intval;
> > double doubleval;
> >
> > file >> intval  >> doubleval;
> >
> > // Now I want to check whether it's an int or a junk value and whether
> it's
> > a double or a junk value !!!!!
> > How can I check that.
> >
> > It's a C++ question but is there anythin in Qt  to check the data type
> ???
> >
> > On Wed, Aug 12, 2009 at 5:35 PM, Srdjan Todorovic
> > <todorovic.s at googlemail.com> wrote:
> >>
> >> Hi,
> >>
> >> On 12/08/2009, Sujan Dasmahapatra <sujan.dasmahapatra at gmail.com> wrote:
> >> >
> >> >
> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
> >> > int numberOfPoints = 201;
> >> > QString testNumberOfPoints = QString::number(numberOfPoints);
> >> >  for(i=0; i<testNumberOfPoints.length(); i++)
> >> >         {
> >> >                 qDebug() << testNumberOfPoints.at(i) << "\n";
> >> >                 if(testNumberOfPoints.at(i) != '0' ||
> >> > testNumberOfPoints.at(i) != '1' || testNumberOfPoints.at(i) != '2' ||
> >> > testNumberOfPoints.at(i) != '3' ||
> >> >                 testNumberOfPoints.at(i) != '4' ||
> >> >  testNumberOfPoints.at(i)
> >> > != '5' ||  testNumberOfPoints.at(i) != '6' || testNumberOfPoints.at(i)
> >> > !=
> >> > '7' ||
> >> >                 testNumberOfPoints.at(i) != '8' ||
> >> > testNumberOfPoints.at(i)
> >> > != '9')
> >>
> >> You might get better performance if you did something like:
> >>
> >> if ( testNumberOfPoints.at(i) < 48 || testNumberOfPoints.at(i) >58)
> >> {
> >>  // display warning
> >> }
> >>
> >> This would require that at() returns an int or a char (i've not
> >> checked). But if you can somehow do an ASCII check, it may be faster.
> >>
> >> Srdjan
> >> _______________________________________________
> >> Qt-interest mailing list
> >> Qt-interest at trolltech.com
> >> http://lists.trolltech.com/mailman/listinfo/qt-interest
> >
> >
> >
> > --
> > Thanks & Regards
> > S. Dasmahapatra
> > B.E. (Aeronautics-Aerodynamics)
> > Bangalore, India
> > Ph:91-9900839788
> > Office:91-80-66470248
> > mail id : sujan.dasmahapatra at gmail.com
> >
> > _______________________________________________
> > Qt-interest mailing list
> > Qt-interest at trolltech.com
> > http://lists.trolltech.com/mailman/listinfo/qt-interest
> >
> >
>



-- 
Thanks & Regards
S. Dasmahapatra
B.E. (Aeronautics-Aerodynamics)
Bangalore, India
Ph:91-9900839788
Office:91-80-66470248
mail id : sujan.dasmahapatra at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090812/79a8b02d/attachment.html 


More information about the Qt-interest-old mailing list