Details
-
Suggestion
-
Resolution: Done
-
P3: Somewhat important
-
5.14.0, 5.14.2, 5.15.0, 6.2.4, 6.3.0
-
None
-
Fedora 32 Linux, CMake, QtCreator 4.12.2
-
-
5
-
e48b4d2b7c1d99ba8962a9c10a1508d16dc33fbf
-
Team B Foundation Sprint 55, Team B Foundation Sprint 56
Description
Not certain whether this is a bug or intended but I noticed that when converting Hex/Octal/Binary strings to their int values I can convert hex using as either "0x64" or "64", Octal using either "0144" or "144", but Binary only using "1100100". If I use "0b1100100" I get a failure.
QString t = "0b1100100";
bool ok = false;
int i;
// t = t.mid(2);
i = t.toInt(&ok, 2);
gives i == 0 and ok == false. With the t=t.mid(2) to strip the Ob off if gives the correct value of 100 (decimal) and ok == true.
Attachments
For Gerrit Dashboard: QTBUG-85002 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
405784,6 | tst_qstringapisymmetry: check toInt() etc also with base != 0 | dev | qt/qtbase | Status: MERGED | +2 | 0 |
406228,7 | Implement support for '0b' prefix in toInt() etc | dev | qt/qtbase | Status: MERGED | +2 | 0 |
406264,4 | tst_qstringapisymmetry: check toInt() etc also with base != 0 | 6.3 | qt/qtbase | Status: MERGED | +2 | 0 |