Unsolved qstring find
-
how would I find / and extract word before and after the / for example
QString a = "hello/test"extract hello and test base on / separation?
-
QVector<QStringRef> words = a.splitRef('/');
-
so word[0] would be "hello", word[1]=test?
-
@s002wjh Yes. Obviously check first if the vector actually has 2 elements in case there's no
/
in the string. -
if I want to assign words[0] to another string is it?
QString tt=words[0];? I'm getting error on this
-
words[0]
is aQStringRef
, so to assign it to aQString
you doQString tt = words[0].toString();
.