PDA

View Full Version : concatenate two values



rk0747
30th May 2010, 11:14
hi all,

please tell me how to make concatenate of two different datatypes

Qstring str="4";
unsigned long lg=100001;

now i want to make the value as lg= 4100001 .(i.e.,"4"+100001)

Thanks,

squidge
30th May 2010, 11:28
Have a look at the QString documentation, you can convert unsigned long to QString and then concatenate.

Naami
30th May 2010, 11:30
Hi;

try use the class QVariant.

Zlatomir
30th May 2010, 11:38
Or something like this:

str.append(QString("%1").arg(lg));

john_god
30th May 2010, 11:43
QString str="4";
unsigned long lg=100001;


str += QString("%1").arg(lg);
qDebug() << str;
lg=str.toLong();
qDebug()<< lg;


Voilá