PDA

View Full Version : qt ready fn to extract ip address from a qstring



nass
26th March 2007, 14:48
hello ethere
is there a qt function to extract an ip address v4 (aaa.bbb.ccc.ddd) from a long QString
(basically reading line by line a text file) ?

thank you
nass

high_flyer
26th March 2007, 15:03
Try QHostAddress::setAddress()
You have the same method under Qt3 as well.

nass
26th March 2007, 15:17
nope that can't really help,
i need a masking sort of function that will read through a string
"ifconfig eth0:1 192.168.1.12"
and will extract the ip from that. hostAddress can only accept solely the actual ip address...
nass

high_flyer
26th March 2007, 15:27
then use QRegExp (http://doc.trolltech.com/3.3/qregexp.html)