Take out a string according to the position in qt


Hi, I have the following string in QT, for example: QString forum="new forum" And I need to take the characters from the third letter. I know it can be right and left but I need only from the third because the chain sometimes gets bigger and I do not use this as a reference.

asked by Perl 06.10.2016 в 18:13

1 answer


I recommend you to study with some tranquility the documentation of Qt, at least that referring to the classes you are using. In this business it is imperative to read the documentation of what you are using.

QString has the mid() function that perfectly meets your requirements:

QString cadena = "new forum";
QString subcad = cadena.mid(3);
qDebug() << subcad;


answered by 07.10.2016 / 09:24