[Qt-interest] how to extract the number from QString
Thiago Macieira
thiago at kde.org
Fri May 21 18:44:43 CEST 2010
Em Sexta-feira 21 Maio 2010, às 14:33:39, hakiim the dream escreveu:
> Hi all, suppose that I have the string abc001. I have to seperate the
> characters from the numeric part so that I have abc and 001
> seperated?Using QString::toInt() does not help to discriminate between a
> zero number and an alpha character since it returns both 0 for the alpha
> character and the integer 0.Thanks in advance.
QString::toInt() has a "bool *ok" parameter that you can pass to find out if it
failed to decode, or if it decoded a zero.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100521/9e740073/attachment.bin
More information about the Qt-interest-old
mailing list