View Full Version : How to split a string line
grsandeep85
29th July 2009, 07:03
Hi All,
I am reading a line from a text file as
56, 545.682, 897.000, -12.369
and the i am storing into an array datumstr[datumno_val] then how to split this string line and display in numberlineEdit=56, XlineEdit= 545.682, YlineEdit=897.000, and ZlineEdit=-12.369
spirit
29th July 2009, 07:08
take a look at QString::split.
grsandeep85
29th July 2009, 10:06
I am using qt-3.3 but QString::split() is in qt-4 please help me to resolve this issue
numbat
29th July 2009, 10:28
You can do it manually. If you are having trouble, have a look at a split implementation (http://cep.xor.aps.anl.gov/software/qt4-x11-4.2.2-browser/d3/d2b/qstring_8cpp-source.html#l05416) (or just copy and paste it).
wagmare
29th July 2009, 10:36
then u convert it in to normal chat* and
do our own c method of strtok()
code to convert QString to const char*
const char *str;
QString path;
QByteArray ba;
ba = path.toLatin1();
str = ba.data();
printf("the string path will be:%s\n", str);
caduel
29th July 2009, 10:42
Qt3: see QStringList::split(); the function was moved in Qt4
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.