Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later
Accepted Solution

check if qstring is number

how can i DO IT?

Developer
Posts: 293
Registered: ‎10-15-2012
My Device: bb10 developer
My Carrier: Orange

Re: check if qstring is number

from the docs you'll find many conversion routines in the QString class (toInt, toFloat, toXXX etc)
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: check if qstring is number

... but to answer your actual question you can actually use the return value to check...

 

QString s = "your text here";

bool isNum;

int value = s.toInt(&isNum);

if (isNum)
   // use returned value
else
   // report error

 Not tested but should work. Smiley Happy 

 

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.