Incrementing String value
-
Well this is my JSON value
"INKA010101002020"
which is in QByteArray, where I've converted it to QString for substring of last 3 digits "020" then I need to add 1 (auto increment +1) to that 3 digit one, where I've converted it to 'int' but didn't work so any suggestions ?? -
Well this is my JSON value
"INKA010101002020"
which is in QByteArray, where I've converted it to QString for substring of last 3 digits "020" then I need to add 1 (auto increment +1) to that 3 digit one, where I've converted it to 'int' but didn't work so any suggestions ?? -
@Vineela Something like
QString str = "INKA010101002020"; QString subStr = str.right(3); int number = subStr.toInt(); ++number; str = str.chopped(3) + QString("%1").arg(number, 3, 10, '0');
-
@jsulm well this was my answer
INKA01010100221.000000000000000000000000000000000000000000000000
I wanted 021 only the last three digits to get added -
@jsulm well this was my answer
INKA01010100221.000000000000000000000000000000000000000000000000
I wanted 021 only the last three digits to get added -
@J-Hilk , @jsulm well INKA010101001 this is my QString value i just want to add 001 to the last so that i get the final value INKA010101001001 like this.
-
@jsulm oh yes ive tried that i got INKA010101001\u0001 this
I've used this codeQString dd= store; dd.append(001);
-
@jsulm oh yes ive tried that i got INKA010101001\u0001 this
I've used this codeQString dd= store; dd.append(001);
-
-
please mark the topic as solved
-
please mark the topic as solved