@JonB said in Help with QTextstream splitting "lang=2":
I have not tested, and you may say it does not apply to you because you will only ever have one line (in which case the whole overhead of using a QTextStream seems quite pointless to me), but what does your new code do now on a file like, say:
var1=value1
var2=value2
MyTextStream is good for splitting a single text line only - it is the replacement for the unsafe sscanf -- you split the line and put values according their types.
var1=value1 is a text line that could be split in two QStrings var and value1.
but if you have var1=15.5 you can put 15.5 directly into the float var.
QString qstr = "lang=2.23";
MyTextStream ss(&qstr, '=', ' ');
QString lang; double kol_lang = 0;
ss >> lang >> fixed >> kol_lang;
QString qstr = "var1=value1";
MyTextStream ss(&qstr, '=', ' ');
QString lang, qval;
ss >> lang >> qval;