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
babakar
Posts: 704
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later
Accepted Solution

check if qstring is number

how can i DO IT?

Please use plain text.
Developer
strobejb
Posts: 267
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)
Please use plain text.
Developer
BBSJdev
Posts: 6,089
Registered: ‎07-05-2012
My Device: Playbook, Z10 LE, Dev Alpha C
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. :smileyhappy: 

 

 


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

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.