[PyKDE] Qstring problem
Hans-Peter Jansen
hpj at urpla.net
Tue Mar 1 15:14:23 GMT 2005
On Tuesday 01 March 2005 15:12, Detlev Offenbach wrote:
> Am Dienstag, 1. März 2005 14:44 schrieb Flávio Codeço Coelho:
> > On Tuesday 01 March 2005 10:16, Hans-Peter Jansen wrote:
> > > Try e.g.:
> > > int(QLineEdit.text().latin1())
> > > or:
> > > int(str(QLineEdit.text()))
>
> How about using QLineEdit.text().toInt() ?
You probably mean QLineEdit.text().toInt()[0], but the to.. methods
impose other problems, when it comes to crossing "int" boundary, and
are slower, then int(str()):
python timing.py 1 12 123 1234 12345 123456 1234567 12345678 \
123456789 1234567890 12345678901 123456789012
value: 1
intstr: 0.27
intlatin1: 0.44
toint: 0.38
tolong: 0.36
tolonglong not supported!
value: 12
intstr: 0.27
intlatin1: 0.46
toint: 0.38
tolong: 0.39
tolonglong not supported!
value: 123
intstr: 0.28
intlatin1: 0.48
toint: 0.37
tolong: 0.38
tolonglong not supported!
value: 1234
intstr: 0.28
intlatin1: 0.48
toint: 0.40
tolong: 0.41
tolonglong not supported!
value: 12345
intstr: 0.29
intlatin1: 0.48
toint: 0.39
tolong: 0.40
tolonglong not supported!
value: 123456
intstr: 0.27
intlatin1: 0.47
toint: 0.42
tolong: 0.42
tolonglong not supported!
value: 1234567
intstr: 0.29
intlatin1: 0.49
toint: 0.41
tolong: 0.42
tolonglong not supported!
value: 12345678
intstr: 0.30
intlatin1: 0.48
toint: 0.41
tolong: 0.44
tolonglong not supported!
value: 123456789
intstr: 0.36
intlatin1: 0.50
toint: 0.43
tolong: 0.43
tolonglong not supported!
value: 1234567890
intstr: 0.37
intlatin1: 0.48
toint: 0.43
tolong: 0.45
tolonglong not supported!
value: 12345678901
intstr: 3.03
intlatin1: 3.10
toint failed!: 0
tolong failed!: 0
tolonglong not supported!
value: 123456789012
intstr: 3.03
intlatin1: 3.11
toint failed!: 0
tolong failed!: 0
tolonglong not supported!
Phil, what's wrong with toLongLong()? Too much compiler trouble?
Pete
-------------- next part --------------
A non-text attachment was scrubbed...
Name: timing.py
Type: text/x-python
Size: 1133 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20050301/7ee68876/timing.py
More information about the PyQt
mailing list