Solved macOS - QString doesn't perform properly
-
Hi,
I have a bit of an issue with QString - its split() and section() methods always return empty QStringList() ro QString(). Same code ported to Windows works.
Any hints please?Edit - code sample:
QString formatter2=settings.value("archivedLabels").toString().section('_',0);
or
QString formatter2=settings.value("archivedLabels").toString().split('_').at(0);
I also tried to replace QString formatter2 with QStringList() making this
QStringList temp=settings.value("archivedLabels").toString().split('_');
and got empty QStringList.
-
@artwaw can't confirm that, you'll have to show us the code, that you're using
int main(int argc, char *argv[]) { QApplication a(argc, argv); QString testString("RM_dd-MM-yyyy"); QStringList splittedList1 = testString.split(QChar('-')); QStringList splittedList2 = testString.split(QChar('_')); QString section1 = testString.section(QChar('-'), 0,0); QString section2 = testString.section(QChar('-'), 1,1); qDebug() << splittedList1 << endl << splittedList2 << endl << section1 << section2; return a.exec(); }
results in:
-
@artwaw
can you provide an example string? -
@J-Hilk RM_dd-MM-yyyy
-
@artwaw can't confirm that, you'll have to show us the code, that you're using
int main(int argc, char *argv[]) { QApplication a(argc, argv); QString testString("RM_dd-MM-yyyy"); QStringList splittedList1 = testString.split(QChar('-')); QStringList splittedList2 = testString.split(QChar('_')); QString section1 = testString.section(QChar('-'), 0,0); QString section2 = testString.section(QChar('-'), 1,1); qDebug() << splittedList1 << endl << splittedList2 << endl << section1 << section2; return a.exec(); }
results in:
-
@J-Hilk Then it must be me or something in my setup. Thank you!